From 0780fe3cf7f857bbcee5831656ad18d0eb835138 Mon Sep 17 00:00:00 2001 From: spalger Date: Mon, 20 Jul 2020 14:46:48 -0700 Subject: [PATCH] remove the command name from `commandFlags._` --- packages/kbn-dev-utils/src/run/run_with_commands.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/kbn-dev-utils/src/run/run_with_commands.ts b/packages/kbn-dev-utils/src/run/run_with_commands.ts index 59ddf27e7cd83..ca56a17b545a7 100644 --- a/packages/kbn-dev-utils/src/run/run_with_commands.ts +++ b/packages/kbn-dev-utils/src/run/run_with_commands.ts @@ -91,6 +91,13 @@ export class RunWithCommands { const commandFlagOptions = mergeFlagOptions(this.options.globalFlags, command.flags); const commandFlags = getFlags(process.argv.slice(2), commandFlagOptions); + // strip command name plus "help" if we're actually executing the fake "help" command + if (isHelpCommand) { + commandFlags._.splice(0, 2); + } else { + commandFlags._.splice(0, 1); + } + const commandHelp = getCommandLevelHelp({ usage: this.options.usage, globalFlagHelp: this.options.globalFlags?.help,