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

core: subcommands silently ignore non-existing flags #27244

Open
l0b0 opened this issue Sep 21, 2023 · 2 comments
Open

core: subcommands silently ignore non-existing flags #27244

l0b0 opened this issue Sep 21, 2023 · 2 comments
Labels
@aws-cdk/core Related to core CDK functionality bug This issue is a bug. p2

Comments

@l0b0
Copy link
Contributor

l0b0 commented Sep 21, 2023

Describe the bug

Running cdk diff with an unknown flag does not result in any kind of indication that there is a problem.

Expected Behavior

cdk diff [other options] --no-such-flag should:

  • Indicate clearly that the --no-such-flag is unknown. This way users immediately recognise where their mistakes are, rather than having to correlate each flag with the documentation to detect the error. Ideally, if there are multiple unknown flags, each one of them should be printed in a similar error message.
  • Exit with a unique non-zero exit code, rather than exit code 0/1. This way anyone automating CDK can tell the difference between different classes of errors.
  • Not run the diffing process, since the user very likely meant for the diffing process to do something which includes another flag.

Current Behavior

cdk diff --no-such-flag runs the diff, prints no warnings related to the flag, and in fact does not indicate in any way that there is a problem.

Reproduction Steps

Run cdk diff --no-such-flag.

Possible Solution

No response

Additional Information/Context

No response

CDK CLI Version

2.93.0 (build 724bd01)

Framework Version

No response

Node.js Version

v18.17.1

OS

NixOS

Language

Typescript

Language Version

5.2.2

Other information

No response

@l0b0 l0b0 added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Sep 21, 2023
@github-actions github-actions bot added the @aws-cdk/core Related to core CDK functionality label Sep 21, 2023
@indrora indrora added p1 needs-review and removed needs-triage This issue or PR still needs to be triaged. labels Sep 21, 2023
@indrora
Copy link
Contributor

indrora commented Sep 21, 2023

This I suspect affects much more than the diff command, as we extract the arguments and parameters from the command line through a more blanket mechanism.

@l0b0
Copy link
Contributor Author

l0b0 commented Sep 21, 2023

Fair enough. It doesn't affect the cdk command itself (try cdk --foo), so hopefully there is a mechanism already in place which can be used.

@indrora indrora changed the title core: diff subcommand silently ignores non-existing flags core: subcommands silently ignore non-existing flags Sep 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/core Related to core CDK functionality bug This issue is a bug. p2
Projects
None yet
Development

No branches or pull requests

3 participants