Skip to content

Commit

Permalink
Fix regression with executing yarn version introduced in 0.19.0 rel…
Browse files Browse the repository at this point in the history
…ease

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 yarnpkg#2268.
  • Loading branch information
Constantine Antonakos committed Jan 20, 2017
1 parent edd1a07 commit fb0f4ad
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/cli/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit fb0f4ad

Please sign in to comment.