Ideas for a module to process command line arguments

Michele Simionato michele.simionato at gmail.com
Wed Jan 12 00:41:24 EST 2011


On Jan 11, 4:06 pm, Alice Bevan–McGregor <al... at gothcandy.com> wrote:
> After looking into it, Plac's default help display isn't very helpful;
> you need to massage your application a fair amount before generating
> nice, complete-looking argument lists and such.  For example:
>
>         def main(verbose: ('prints more info', 'flag', 'v'), dsn: 'connection
> string'):
>
>         @annotate(dsn="connection string", verbose="prints more info")
>         def main(dsn, verbose=False):
>
> The latter is marrow.script, and even without the annotation a more
> complete help text is generated.  The -v and flag nature are assumed
> from the first unique character and default value.  (Flags, when
> present on the command line, invert the default value.)

Honestly I do not see any significant difference both in the
level of verbosity for the annotations and in the quality  of the help
message provided in the absence of annotations. Originally plac too
was able to recognize flags automatically by looking at the default
value (if the default value is a boolean then the option is a flag);
however I removed that functionality because I wanted to be able to
differentiate between flag and (smart) options (see
http://micheles.googlecode.com/hg/plac/doc/plac.html#scripts-with-options-and-smart-options).



More information about the Python-list mailing list