|
From: | Paolo Bonzini |
Subject: | Re: [PATCH 3/4] qemu-iotests: let "check" spawn an arbitrary test command |
Date: | Tue, 23 Mar 2021 18:22:21 +0100 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.0 |
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
[Prev in Thread] | Current Thread | [Next in Thread] |