Message221101
Another approach would be make the 'argparse' argument a 'switch' command, and act on it after parsing. Roughly what I have in mind is:
parser.add_argument('--verbosity', dest='switch_verbosity, action='store_true', help='....'%config_defaults['verbose'])
....
args = parser.parse_args()
verbosity = config_defaults['verbose']
if args.switch_verbosity:
verbosity = not verbosity
In other words, you don't need to do all of the manipulation of values in 'argparse' itself. Its primary purpose is to decipher what the user wants, and secondarily to guide him (with help, error messages, etc). |
|
Date |
User |
Action |
Args |
2014-06-20 16:59:27 | paul.j3 | set | recipients:
+ paul.j3, bethard, r.david.murray, d0n |
2014-06-20 16:59:27 | paul.j3 | set | messageid: <1403283567.91.0.970332230534.issue21805@psf.upfronthosting.co.za> |
2014-06-20 16:59:27 | paul.j3 | link | issue21805 messages |
2014-06-20 16:59:27 | paul.j3 | create | |
|