CLI parsing—with `--help` text—`--foo bar`, how to give additional parameters to `bar`?
On 16Oct2020 10:59, Samuel Marks <samuelmarks at gmail.com> wrote:
>That syntax isn?t so bad! =]
>How would you suggest the help text for this looks? (don?t worry about
>implementation, just what goes to stdout/stderr)
Specify use of the named optimizer with optional additional
learning_rate Scale of gullibility, a float.
something_else Another tuning thing,
which is the style I use in my own usage messages. Possibly also allow the
"=value" to be optional (where sensible per parameter), since it is so easy.
>PS: Yeah I used square brackets for my Bash arrays
By the time I want real arrays in my shell scripts I'm often verging on the
regime where it's time to transition to a more expressive language. Like
Python :-) (Unless of course you're using a bunch of shell control constructs
like pipes, which are succintly written in the shell.)
Cameron Simpson <cs at cskk.id.au>