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

fix: report an error when unknown commands are given #486

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

displague
Copy link
Member

@displague displague commented Aug 26, 2024

From #485 (comment)

(this PR should be rebased after that PR, cherry-pick 08407f8)

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]>
@displague displague changed the title report an error when unknown commands are given fix: report an error when unknown commands are given Aug 26, 2024
@@ -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")
Copy link
Member Author

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants