> On 19 Apr 2021, at 10:57, Loris Bennett <loris.benn...@fu-berlin.de> wrote: > > Hi, > > I have various small programs which tend to have an interface like the > following example: > > usage: grocli [-h] [-o {check,add,delete}] [-u USERS [USERS ...]] [-g GROUP] > > Command line grouper tool > > optional arguments: > -h, --help show this help message and exit > -o {check,add,delete}, --operation {check,add,delete} > operation to apply > -u USERS [USERS ...], --users USERS [USERS ...] > users to apply operation to > -g GROUP, --group GROUP > group to apply operation to > > However, the options -o, -u, and -g are required, not optional.
You could use positional args like this: grocli check user,user group Barry > > The documentation > > https://docs.python.org/3/library/argparse.html#required > > advises against required options and here > > > https://stackoverflow.com/questions/24180527/argparse-required-arguments-listed-under-optional-arguments > > a way of adding a section 'required arguments' to the usage is > described. > > I would be interested to know what the general thinking on "required > options" is. Is there just a better way of designing such interfaces? > > Cheers, > > Loris > > -- > This signature is currently under construction. > -- > https://mail.python.org/mailman/listinfo/python-list > -- https://mail.python.org/mailman/listinfo/python-list