Closed GoogleCodeExporter closed 9 years ago
What did you try that didn't work?
>>> parser = argparse.ArgumentParser()
>>> subparsers = parser.add_subparsers()
>>> cmd1 = subparsers.add_parser('cmd1')
>>> cmd1.add_argument('-v', dest='foo')
>>> cmd2 = subparsers.add_parser('cmd2')
>>> cmd2.add_argument('-v', dest='bar')
>>> parser.parse_args(['cmd1', '-v', 'badger'])
Namespace(foo='badger')
>>> parser.parse_args(['cmd2', '-v', 'badger'])
Namespace(bar='badger')
Original comment by steven.b...@gmail.com
on 6 Dec 2009 at 11:44
Original comment by steven.b...@gmail.com
on 23 Jul 2010 at 11:44
Original issue reported on code.google.com by
whart222
on 25 Nov 2009 at 8:58