--- On Sun, 11/16/08, Torsten Schoenfeld <[EMAIL PROTECTED]> wrote:
> From: Torsten Schoenfeld <[EMAIL PROTECTED]>
> Subject: Is there interest in GOption support?
> To: [email protected]
> Date: Sunday, November 16, 2008, 3:50 AM
> Aloha,
>
> I've finally completed a patch that adds GOption
> support to Glib. It allows you to this (from the SYNOPSIS):
>
> my ($verbose, $source, $filenames) = ('',
> undef, []);
>
> my $entries = [
> { long_name => 'verbose',
> short_name => 'v',
> arg_type => 'none',
> arg_value => \$verbose,
> description => 'be verbose' },
>
> { long_name => 'source',
> short_name => 's',
> arg_type => 'string',
> arg_value => \$source,
> description => 'set the source',
> arg_description => 'source' },
>
> [ 'filenames', 'f',
> 'filename-array', \$filenames ],
> ];
>
> my $context = Glib::OptionContext->new ('-
> urgsify your life');
> $context->add_main_entries ($entries);
> $context->parse ();
>
> # $verbose, $source, and $filenames are now
> updated according to the
> # command line options given
>
> If you call this program with --help, you will
> automatically get this:
>
> Usage:
> test.pl [OPTION...] - urgsify your life
>
> Help Options:
> -?, --help Show help options
>
> Application Options:
> -v, --verbose be verbose
> -s, --source=source set the source
> -f, --filenames
>
> You can also add gtk+'s options:
>
> $context->add_group (Gtk2->get_option_group
> (TRUE));
>
> Now --help will also print this:
>
> --help-all Show all help options
> --help-gtk Show GTK+ Options
>
> And --help-all and --help-gtk will do just what it says
> there.
>
> The question now is: would you use this instead of any of
> the dozens of options parsers Perl already has? The patch
> adds quite a bit of code to Glib which we don't want to
> commit without there being demand for the feature.
>
> (The performance impact of the patch seems to be
> negligible: any slowdown of 'use Glib' I could
> measure was within the error bounds.)
> _______________________________________________
My friend and I once (more than 10 year ago) developed very similar
approach/interface.
So, I'm in favor of inclusion.
Thanks,
Sergei.
_______________________________________________
gtk-perl-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/gtk-perl-list