mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-25 16:22:42 +01:00
Parse "--help" correctly in arc
Summary: We delegate parsing to `PhutilArgumentParser` but then skip the parts of the code which do something with this flag. In particular, `arc --help list` just runs `arc list`. See https://github.com/facebook/arcanist/issues/58 Test Plan: Ran `arc --help`, `arc list --help`, `arc --help list`, `arc --help help --help`. Got expected help in all cases. Reviewers: vrana, chad, btrahan Reviewed By: chad CC: aran Differential Revision: https://secure.phabricator.com/D4023
This commit is contained in:
parent
cd7f86d380
commit
db25adb069
1 changed files with 8 additions and 1 deletions
|
@ -41,6 +41,7 @@ $force_conduit = $args->getArg('conduit-uri');
|
||||||
$force_conduit_version = $args->getArg('conduit-version');
|
$force_conduit_version = $args->getArg('conduit-version');
|
||||||
$conduit_timeout = $args->getArg('conduit-timeout');
|
$conduit_timeout = $args->getArg('conduit-timeout');
|
||||||
$load = $args->getArg('load-phutil-library');
|
$load = $args->getArg('load-phutil-library');
|
||||||
|
$help = $args->getArg('help');
|
||||||
|
|
||||||
$argv = $args->getUnconsumedArgumentVector();
|
$argv = $args->getUnconsumedArgumentVector();
|
||||||
$args = array_values($argv);
|
$args = array_values($argv);
|
||||||
|
@ -59,8 +60,14 @@ try {
|
||||||
phutil_get_library_root('arcanist'));
|
phutil_get_library_root('arcanist'));
|
||||||
|
|
||||||
if (!$args) {
|
if (!$args) {
|
||||||
|
if ($help) {
|
||||||
|
$args = array('help');
|
||||||
|
} else {
|
||||||
throw new ArcanistUsageException("No command provided. Try 'arc help'.");
|
throw new ArcanistUsageException("No command provided. Try 'arc help'.");
|
||||||
}
|
}
|
||||||
|
} else if ($help) {
|
||||||
|
array_unshift($args, 'help');
|
||||||
|
}
|
||||||
|
|
||||||
$global_config = ArcanistBaseWorkflow::readGlobalArcConfig();
|
$global_config = ArcanistBaseWorkflow::readGlobalArcConfig();
|
||||||
$system_config = ArcanistBaseWorkflow::readSystemArcConfig();
|
$system_config = ArcanistBaseWorkflow::readSystemArcConfig();
|
||||||
|
|
Loading…
Reference in a new issue