-
Notifications
You must be signed in to change notification settings - Fork 46
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
fix: report an error when unknown commands are given #486
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Marques Johansson <[email protected]>
…dition args Signed-off-by: Marques Johansson <[email protected]>
Signed-off-by: Marques Johansson <[email protected]>
Signed-off-by: Marques Johansson <[email protected]>
PR was made by manually walking the list of files in internal/ that did not specify Args and adding an Args definition. git grep -n -e NewCommand -e Cmd\ :\= $(git grep -L Args internal/) "docs", "emdocs", and "completion" were not included because they use Args and have an existing Args definition. Signed-off-by: Marques Johansson <[email protected]>
@@ -104,5 +102,7 @@ func (c *Client) Retrieve() *cobra.Command { | |||
|
|||
retrieveProjectCmd.Flags().StringVarP(&projectName, "project", "n", "", "The name of the project.") | |||
retrieveProjectCmd.Flags().StringVarP(&projectID, "id", "i", "", "The project's UUID, which can be specified in the config created by metal init or set as METAL_PROJECT_ID environment variable.") | |||
retrieveProjectCmd.MarkFlagsMutuallyExclusive("id", "project") |
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.
This is the only change that is not Args: cobra.NoArgs,
.
This takes advantage of MarkFlagsMutuallyExclusive
to replace the conflicting id/project field che k in projects retrieve
. This is the only location where this Cobra helper seemed to fit.
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.
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.
Ahh. The second one is in this commit/cherry-pick. The first one was included in #485 and would be removed from this PR in a rebase.
From #485 (comment)
(this PR should be rebased after that PR, cherry-pick 08407f8)