[prev in list] [next in list] [prev in thread] [next in thread] 

List:       python-ideas
Subject:    [Python-ideas] Re: argparse: reduce complexity around 'subcommand action objects'?
From:       Chris Angelico <rosuav () gmail ! com>
Date:       2021-09-15 20:08:43
Message-ID: CAPTjJmpBYRY9fD8qiYMwEXzrnAZq_0E3=E=PndLxd8hJSFh5bg () mail ! gmail ! com
[Download RAW message or body]

On Thu, Sep 16, 2021 at 5:28 AM <rleonar7@uoregon.edu> wrote:
> 
> I would love to make the 'subcommands' functionality provided in argparse more \
> user-friendly. I think I have a worthwhile feature request to share:
> 
> * Be able to add multiple subcommands to an ArgumentParser, without needing to \
> track the 'action_object' 
> I've outlined an motivating example below, and shared an implementation of this \
> feature that I've started using in one of my projects. 

A reasonable idea, but what I'd recommend is building a wrapper around
argparse that does what you want. One good example is clize:

https://pypi.org/project/clize/

ChrisA
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-leave@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/LAYZXH44ED73LI6KGHFT3KYBQSRGOXBH/
 Code of Conduct: http://python.org/psf/codeofconduct/


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic