Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.

Commit dc7a282

Browse files
authored
Merge pull request #5834 from trufflesuite/fix-cli
Bug fix: ensure yargs receives the correct command name when it has a typo
2 parents b04cb5b + 94ee5f1 commit dc7a282

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

packages/core/lib/command-utils.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ const getCommand = ({ inputStrings, options, noAliases }) => {
4949
// Did we find only one command that matches? If so, use that one.
5050
if (possibleCommands.length === 1) {
5151
chosenCommand = possibleCommands[0];
52+
// if they miskey a command we need to make sure it is correct so that
53+
// yargs can parse it correctly later
54+
inputStrings.shift();
55+
inputStrings.unshift(chosenCommand);
5256
break;
5357
}
5458
currentLength += 1;

0 commit comments

Comments
 (0)