/* g++ -o optiontest `pkg-config --libs --cflags glibmm-2.4` optiontest.cpp */

#include <stdio.h>

#include <glibmm.h>


int main(int argc, char ** argv)
{
  Glib::ustring search;
  Glib::init();

  Glib::OptionGroup options("Foo", "Bar options");

  Glib::OptionEntry entry;
  entry.set_long_name("search");
  entry.set_flags(Glib::OptionEntry::FLAG_OPTIONAL_ARG);
  entry.set_description("Open the search all notes window with the search text.");
  // name of the command line argument
  entry.set_arg_description("text");
  options.add_entry(entry, search);

  Glib::OptionContext context;
  context.set_main_group(options);
  try {
      context.parse(argc, argv);
  }
  catch(...) {
  }
  
  if(!search.empty()) {
    printf("search param is '%s'\n", search.c_str());
  }

  return 0;
}
