Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLI commands silently ignore extra command line arguments #1520

Open
2 of 4 tasks
Pipeliner opened this issue Feb 9, 2022 · 2 comments
Open
2 of 4 tasks

CLI commands silently ignore extra command line arguments #1520

Pipeliner opened this issue Feb 9, 2022 · 2 comments

Comments

@Pipeliner
Copy link

Is there an existing issue for this?

  • 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
  • Linux

Other

No response

@kamilmysliwiec
Copy link
Member

Would you like to create a PR to address this issue?

@Pipeliner
Copy link
Author

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?

@Pipeliner Pipeliner changed the title Generators silently ignore extra command line arguments CLI commands silently ignore extra command line arguments Feb 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants