CVS style argument parsing?
Josef Wolf
jw at raven.inka.de
Tue Jul 20 17:19:11 EDT 2004
Hello!
Is it possible to have CVS-style command line options with the optparse
module? I could get as far as:
import sys
from optparse import OptionParser, OptionGroup
parser = OptionParser()
opt_global = OptionGroup (parser, "Global options")
opt_global.add_option("-m", "--mode", choices=["import", "dump"],
dest="mode", default="dump",
help="One out of import, dump")
opt_global.add_option("-d", "--dbname", default="test",
help="The name of the database")
opt_global.add_option("-D", "--dbpath", default=Cnf.dbpath,
help="The path to the database")
opt_dump = OptionGroup (parser, "Dumper options")
opt_dump.add_option("-v", "--dump-values",
action="store_true", dest="values", default=False,
help="Dump values.")
How can I get rid of the "-m" option so that
myscript -dfoo dump -v
would be possible?
--
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