CLI parsing=?utf-8?B?4oCU?=with `--help` text=?utf-8?B?4oCU?=`--foo bar`, how to give additional parameters to `bar`?

Dieter Maurer dieter at handshake.de
Fri Oct 16 00:47:38 EDT 2020


Samuel Marks wrote at 2020-10-16 10:09 +1100:
>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.

Do you know that with `argparse` you can specify how many arguments an option
expects? Thus, it should be quite easily possible to
have --opt <o1> <o2> ...
Do you know that you can define new `Action`s for `argparse`?
This way, you could properly process `--opt <o1>,<o2>, ...`.


More information about the Python-list mailing list