nest-cli
nest-cli copied to clipboard
CLI commands silently ignore extra command line arguments
Is there an existing issue for this?
- [X] I have searched the existing issues
Current behavior
Running nest g resource aa bb cc dd ee creates aa resource in bb folder, silently ignoring trailing arguments.
Minimum reproduction code
https://gist.github.com/Pipeliner/bdbdb1a0813ce3fe14ae0c5a35c158ed
Steps to reproduce
No response
Expected behavior
An error message and non-zero return code.
Package version
8.2.0
NestJS version
8.2.6
Node.js version
No response
In which operating systems have you tested?
- [ ] macOS
- [ ] Windows
- [X] Linux
Other
No response
Would you like to create a PR to address this issue?
The command is defined at https://github.com/nestjs/nest-cli/blob/master/commands/generate.command.ts#L11
The trailing arguments just go to program.args and so far I see no commander-native way to ensure there are none.
Also the same issue seems to affect at least some other commands, e.g.
$ nest new a b c
⚡ We will scaffold your app in a few seconds..
CREATE a/.eslintrc.js (631 bytes)
CREATE a/.prettierrc (51 bytes)
CREATE a/README.md (3339 bytes)
CREATE a/nest-cli.json (64 bytes)
...
@kamilmysliwiec what kind of tests would this PR require?