From e508eae9837f4a4d67fb7e812a784c016e4dfa29 Mon Sep 17 00:00:00 2001 From: Greg Anderson Date: Thu, 28 Sep 2017 22:57:42 +0200 Subject: [PATCH] Identify --help and -h during args preprocessing, and convert to 'help' command if found. (#2983) --- src/Preflight/PreflightArgs.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/Preflight/PreflightArgs.php b/src/Preflight/PreflightArgs.php index ab3e031da3..dc36b21f90 100644 --- a/src/Preflight/PreflightArgs.php +++ b/src/Preflight/PreflightArgs.php @@ -65,9 +65,22 @@ public function optionsWithValues() '--backend' => 'setBackend', '--drush-coverage=' => 'setCoverageFile', '--strict=' => 'setStrict', + '--help' => 'adjustHelpOption', + '-h' => 'adjustHelpOption', ]; } + /** + * If the user enters '--help' or '-h', thrown that + * option away and add a 'help' command to the beginning + * of the argument list. + */ + public function adjustHelpOption() + { + $drushPath = array_shift($this->args); + array_unshift($this->args, $drushPath, 'help'); + } + /** * Map of option key to the corresponding config key to store the * preflight option in.