Re: Option parser



On Thu, Jul 29, 2004 at 10:21:12PM +0200, Anders Carlsson wrote:
> Option groups
> -------------
> 
> In order to support options from different sources, GOption has
> something called option groups. An option context has a main group, but
> can also have a number of auxiliary groups for options coming from other
> places. Options from other groups can also be merged into the main
> group.
> 
> Here's the --help output from a simple app:
> 
> Usage:
>   nautilus [OPTION...] [URI...]
> 
> Help Options:
>   --help                    Show help options
>   --help-all                Show all help options
>   --help-gtk                Show Gtk+ help options
> 
> Application Options
>   -b, --browser             Open a browser window
>   -q, --quit                Quit Nautilus
>   --no-desktop              Do not manage the desktop
>   -d, --display=DISPLAY     X display to use
> 
> This app has a gtk group which has the --display option merged into the
> main group. The --help-gtk output looks like this:
> 
> Usage:
>   nautilus [OPTION...] [URI...]
> 
> Help Options:
>   --help                    Show help options
>   --help-all                Show all help options
>   --help-gtk                Show Gtk+ help options
> 
> GTK+ Options
>   -d, --display=DISPLAY     X display to use
>   --g-fatal-warnings        Make all warnings fatal
> 
> This makes --help rather clean while still allowing the user to get
> information about more rarely used options. (Try running nautilus --help
> to see how it looks now, it's not pretty!)

Why should a _user_ care whether or not the options are for the
application or GTK+? They don't even know about GTK+. I say make one
set of options, with the GTK+ options first, followed by the
application options.

-- 
albert chin (china thewrittenword com)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]