On 23/03/21 18:11, Vladimir Sementsov-Ogievskiy wrote:
If you have positional arguments that must begin with - and don’t look
like negative numbers, you can insert the pseudo-argument '--' which
tells parse_args() that everything after that is a positional argument:
So, as I understand argparse supports '--' feature out of the box. So,
we can keep '*' as is, and it would parse all remaining positional
arguments which are either tests or the command, and '--' will be
automatically dropped. So, we only need to check existing of '--' in
original sys.argv to chose our behavior.
There is still a difference with REMAINDER:
./check aa -- bb
=> REMAINDER: error because ./-- is not a test
=> look for '--': invoke "aa -- bb"
So I think REMAINDER provides the best behavior overall.
Paolo