CVS style argument parsing?

Josef Wolf jw at raven.inka.de
Wed Jul 21 02:37:05 EDT 2004


Jeff Epler schrieb im Artikel <mailman.652.1090369306.5135.python-list at python.org>:

> Don't use OptionGroups for each command.  Instead, you'll have the
> OptionParser for the "main" arguments, and the option parser for each
> command.

I tried to do this before, and had exactly the problem you describe below.

> By using parser.disable_interspersed_args() you can make the parsing of
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^
> "-a b -c".split() handle "-a" and return "b -c".split() as the
> positional args.  Then, depending on what b is, send -c to a separate
> parser instance.

Aaaahhh, this was the bit of information I was missing.  Is it "legal" to
use this method?  It seems not to be documented in the library reference?

Thanks!

-- 
Please visit and sign http://petition-eurolinux.org and http://www.ffii.org
-- Josef Wolf -- jw at raven.inka.de --



More information about the Python-list mailing list