Gisle Vanem <gisle.va...@gmail.com> writes: > Loris Bennett wrote: > >> 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. > > Just a nitpick. > > To quote from https://en.wikipedia.org/wiki/Usage_message > "To indicate required arguments, Angled brackets are > commonly used, ..." > > So then it should better be written as: > grocli [-h] <-o {check,add,delete}> <-u USERS [USERS ...]> <-g GROUP>
I would take that with a pinch of salt. The Wikipedia page doesn't give any examples, let alone any that might be considered somehow typical or representative. Looking at a few tools I use regularly (awk, cat, grep, sed, ssh, tmux) I couldn't find any which use the angled-bracket notation. So maybe the notation is not common or just not many programs have this type of option. The latter would correspond with sentiment in the argparse documentation that it is an approach to be avoided. In any case, the usage line is generated automatically by argsparse. However, I am more interested in what an alternative approach might look like. Cheers, Loris -- This signature is currently under construction. -- https://mail.python.org/mailman/listinfo/python-list