pwclient handling of argparse options

Bernhard Reutner-Fischer rep.dot.nop at gmail.com
Mon Oct 19 18:57:43 AEDT 2015


On October 17, 2015 4:25:54 AM GMT+02:00, Mike Frysinger <vapier at gentoo.org> wrote:
>On 16 Oct 2015 16:39, Brian Norris wrote:
>>          commit_str = args.get('c')
>
>if you feel like cleaning things up, i find the args behavior weird and
>non-standard.  it does:
>	args = action_parser.parse_args()
>	args = dict(vars(args))
>	action = args.get('subcmd')
>
>normally argparse code does:
>	args = action_parser.parse_args()
>	action = args.subcmd
>
>i'm not sure why this dict/get style was picked.  maybe Bernhard can
>shed some light here.

At this point all we need is a dict and I found it easier and shorter to type.
I don't have a strong opinion about it, so if it's more pythonic to rephrase it, please do.

I do remember to have gone through hoops to handle --help and --hash at the same time AND allowing for recursive printing of all help (I considered that a feature back then) but I do not remember if or why my attempt to use a conflict_handler didn't work out. Could be there was a bug in argparse back then or maybe I just goofed it.

Thanks,
>-mike




More information about the Patchwork mailing list