CLI parsing—with `--help` text—`--foo bar`, how to give additional parameters to `bar`?

2QdxY4RzWzUUiLuE at potatochowder.com 2QdxY4RzWzUUiLuE at potatochowder.com
Thu Oct 15 19:50:21 EDT 2020


On 2020-10-16 at 10:20:40 +1100,
Cameron Simpson <cs at cskk.id.au> wrote:

> On 16Oct2020 10:09, Samuel Marks <samuelmarks at gmail.com> wrote:
> >Yes it’s my module, and I’ve been using argparse
> >https://github.com/SamuelMarks/ml-params
> >
> >No library I’ve found provides a solution to CLI argument parsing for my
> >use-case.

Out of curiosity, what do your command line interfaces require that
argparse and other libraries don't have?

Yes, if my only tool is a hammer, then every problem looks like a nail,
but I've yet to have a requirement that the POSIX rules don't cover.

> >So I’ll write one ...

Been there.  Done that.  :-)

> > [...] But what should it look like, syntactically and semantically?

[...]

> In particular, I would not invent yet another command line syntax.

I agree.  The POSIX Utility Syntax and Guidelines:

    https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap12.html

(I believe argparse supports a superset of the POSIX syntax.)

I haven't found a definitive definition of GNU long options, only
examples.

HTH,
Dan


More information about the Python-list mailing list