From db25adb0690e2296b142c4ddc583fcce97f30ef8 Mon Sep 17 00:00:00 2001 From: epriestley Date: Thu, 22 Nov 2012 08:36:28 -0800 Subject: [PATCH] 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 --- scripts/arcanist.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/scripts/arcanist.php b/scripts/arcanist.php index 01a3a0e1..e42f93e6 100755 --- a/scripts/arcanist.php +++ b/scripts/arcanist.php @@ -41,6 +41,7 @@ $force_conduit = $args->getArg('conduit-uri'); $force_conduit_version = $args->getArg('conduit-version'); $conduit_timeout = $args->getArg('conduit-timeout'); $load = $args->getArg('load-phutil-library'); +$help = $args->getArg('help'); $argv = $args->getUnconsumedArgumentVector(); $args = array_values($argv); @@ -59,7 +60,13 @@ try { phutil_get_library_root('arcanist')); if (!$args) { - throw new ArcanistUsageException("No command provided. Try 'arc help'."); + if ($help) { + $args = array('help'); + } else { + throw new ArcanistUsageException("No command provided. Try 'arc help'."); + } + } else if ($help) { + array_unshift($args, 'help'); } $global_config = ArcanistBaseWorkflow::readGlobalArcConfig();