-
Notifications
You must be signed in to change notification settings - Fork 80
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
feat: improve missing argument error messages #711
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #711 +/- ##
==========================================
- Coverage 58.77% 58.48% -0.29%
==========================================
Files 179 180 +1
Lines 6539 6497 -42
==========================================
- Hits 3843 3800 -43
Misses 2088 2088
- Partials 608 609 +1 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me :) Can be merged once #709 is in main
:)
🤖 I have created a release *beep* *boop* --- ## [1.43.0](v1.42.0...v1.43.0) (2024-04-03) ### Features * allow deletion of multiple resources at once ([#719](#719)) ([3b896fe](3b896fe)) * improve missing argument error messages ([#711](#711)) ([e7f9e74](e7f9e74)) * **server:** allow JSON & YAML output in reset-password ([#716](#716)) ([373287b](373287b)), closes [#715](#715) ### Bug Fixes * removing last rule from firewall fails with invalid_input error ([#696](#696)) ([acab17c](acab17c)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
This PR adds a custom Cobra command validator that outputs useful errors when positional arguments are missing during command execution. For example, such an error could look like this:
Where previously it would look like this:
Additionally, if there are more arguments provided than necessary, the following error message will appear:
This is done by parsing the
Use
property of a Cobra command with a regular expression and then matching the corresponding missing arguments.Fixes #700