This repository has been archived by the owner on Feb 12, 2024. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: error when command is unknown (#2916)
Since yargs v14, using `.parse(command)` with an unknown command causes an [error to be thrown](yargs/yargs#1419) instead of the help text being printed. One solution is to use `.argv` instead of `.parse(command)` but we use the `.parse(command)` variant to enable testing as the passed command is evaluated rather than `process.argv`, which is what happens when you call `.argv`. Instead if we detect a error caused by an unknown command, use the parser to show help instead of version of yargs that had `.parse(command)` called on it.
- Loading branch information