#include <glibmm/optioncontext.h>
#include <iostream>


int main (int argc, char *argv[]) {
	bool feature1 = true;
	bool feature2 = false;

	Glib::OptionContext context("option parser bug demonstration");
	Glib::OptionEntry entry1a, entry1b, entry2a, entry2b;
	entry1a.set_long_name("enable-feature1");
	entry1a.set_description("Enable feature1");
	entry2a.set_long_name("enable-feature2");
	entry2a.set_description("Enable feature2");

	entry1b.set_long_name("disable-feature1");
	entry1b.set_description("Disable feature1");
	entry1b.set_flags(Glib::OptionEntry::FLAG_REVERSE);
	entry2b.set_long_name("disable-feature2");
	entry2b.set_description("Disable feature2");
	entry2b.set_flags(Glib::OptionEntry::FLAG_REVERSE);

	Glib::OptionGroup option_group("", "");
	//option_group.add_entry(entry1a, feature1);
	option_group.add_entry(entry1b, feature1);
	option_group.add_entry(entry2a, feature2);
	//option_group.add_entry(entry2b, feature2);

	context.set_main_group(option_group);

	try {
		context.parse(argc, argv);
	}
	catch(const Glib::OptionError& error) {
		std::cout << "option parsing failed: " << error.what() << std::endl;
		return 1;
	}

	std::cout << "feature1: " << feature1 << std::endl;	
	std::cout << "feature2: " << feature2 << std::endl;	

	return 0;
}
