[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

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

> On 16Oct2020 10:09, Samuel Marks <samuelmarks at> wrote:
> >Yes it?s my module, and I?ve been using argparse
> >
> >
> >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:

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

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