HomePhabricator

Better arg handling

Authored by hashar on Mar 13 2019, 9:03 AM.

Description

Better arg handling

We have several options and an argument that each accept multiple values
(nargs='*') and values might end up being shallowed, consider for
example:

quibble --run phpunit mediawiki/extensions/BoilerPlate

In this case, the repository is not cloned since Quibble considers it to
be a stage to run. The workaround is to use a double dash '--' to stop
option processing:

quibble --run phpunit -- mediawiki/extensions/BoilerPlate

But it is very easy to entirely miss that.

Instead, we should only have one argument accepting multiple parameters:
the list of projects to clone. As such:

--run, --skip are used to specify known stages + the magic 'all'.
Convert them to 'choices' which has the added benefit of validating the
given stages.

--commands is intended to be used as:

--commands 'echo hello' 'exec phpunit --debug'

But would shallow the list of projects to clone. Make it possible to
specify it multiple time and have append to a list. Add a singular alias
'--command' which better reflect the new semantic and a shortoption '-c'
for convenience.

--commands keep its original behavior and will be dropped eventually. It
is marked as deprecated in the usage help.

Make --commands and -c mutually exclusive.

Bug: T218357
Change-Id: I39212933bab9d07a817c92af3360f34baeb86d04

Details

Committed
jenkins-botApr 11 2019, 8:12 PM
Parents
rQUIBBLE1906bf4be185: Default to use 4 git workers
Branches
Unknown
Tags
Unknown
ChangeId
I39212933bab9d07a817c92af3360f34baeb86d04