From fb0f4ad5a958745b24601e0a3fc8af66484e314c Mon Sep 17 00:00:00 2001 From: Constantine Antonakos Date: Thu, 19 Jan 2017 20:41:05 -0500 Subject: [PATCH] Fix regression with executing `yarn version` introduced in 0.19.0 release There was a conflict when commander attempts to parse the incoming args between the command executed and the options since the name `version` was shared. This relates to PR #2268. --- src/cli/index.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/cli/index.js b/src/cli/index.js index eb41c60428..ef98355354 100644 --- a/src/cli/index.js +++ b/src/cli/index.js @@ -170,8 +170,13 @@ if (commandName === 'help' || args.indexOf('--help') >= 0 || args.indexOf('-h') process.exit(1); } +if (!command) { + args.unshift(commandName); + command = commands.run; +} +invariant(command, 'missing command'); + // parse flags -args.unshift(commandName); commander.parse(startArgs.concat(args)); commander.args = commander.args.concat(endArgs);