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

Replace deprecated ExactValidArgs with MatchAll in user_guide and shell_completions example #1836

Merged

Conversation

doniacld
Copy link
Contributor

Update the example from shell_completions by replacing ExactValidArgs which is deprecated from the documentation by MatchAll(ExactArgs(1), OnlyValidArgs).

@CLAassistant
Copy link

CLAassistant commented Oct 20, 2022

CLA assistant check
All committers have signed the CLA.

Copy link
Collaborator

@marckhouzam marckhouzam left a comment

Choose a reason for hiding this comment

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

Thanks for noticing @doniacld

@@ -71,7 +71,7 @@ PowerShell:
`,cmd.Root().Name()),
DisableFlagsInUseLine: true,
ValidArgs: []string{"bash", "zsh", "fish", "powershell"},
Args: cobra.ExactValidArgs(1),
Args: MatchAll(ExactArgs(1), OnlyValidArgs),
Copy link
Collaborator

Choose a reason for hiding this comment

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

This should be cobra.MatchAll(ExactArgs(1), OnlyValidArgs),

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, I fixed it it is actually cobra.MatchAll(cobra.ExactArgs(1), cobra.OnlyValidArgs) :)

Copy link
Collaborator

Choose a reason for hiding this comment

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

ha! Good point!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for noticing @doniacld

I did not see any hacktoberfest labels in PRs around here but I was wondering if you would accept adding the label hacktoberfest-accepted to mine so it can count. Thanks in advance 😇

NB: Actually found the problem by solving an issue in Trivy btw 🚀

Copy link
Collaborator

Choose a reason for hiding this comment

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

While we're at it, would you mind also fixing the 3 missing cobra. prefixes in:

Args: MatchAll(ExactArgs(2), OnlyValidArgs),

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For sure, fixed and checking if there is any left.

@doniacld doniacld force-pushed the fix/update-shell-completion-example branch from e6b6241 to b786670 Compare October 20, 2022 20:12
@doniacld doniacld force-pushed the fix/update-shell-completion-example branch from b786670 to 17573c4 Compare October 20, 2022 20:27
@doniacld doniacld changed the title Replace deprecated ExactValidArgs with MatchAll in shell_completions example Replace deprecated ExactValidArgs with MatchAll in user_guide and shell_completions example Oct 20, 2022
Copy link
Collaborator

@marckhouzam marckhouzam left a comment

Choose a reason for hiding this comment

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

LGTM

@marckhouzam marckhouzam merged commit 4b9d00d into spf13:main Oct 20, 2022
@marckhouzam marckhouzam added kind/documentation Documentation of cobra itself hacktoberfest-accepted For contributions in the context of hacktoberfest labels Oct 20, 2022
@marckhouzam
Copy link
Collaborator

Thanks @doniacld ! Label added. Let me know if I have to do something else for this contribution to count for your stats.

@doniacld
Copy link
Contributor Author

Thanks @doniacld ! Label added. Let me know if I have to do something else for this contribution to count for your stats.

All good! Thanks a lot. 🙏🏽

@marckhouzam marckhouzam added this to the 1.7.0 milestone Oct 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hacktoberfest-accepted For contributions in the context of hacktoberfest kind/documentation Documentation of cobra itself
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants