J
Josef Wolf
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?
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?