Skip to content

Conversation

@lavafroth
Copy link

@lavafroth lavafroth commented Jul 2, 2022

This commit adds flag groups which are mutually exclusive but required, as in, at least one of the flags in a group must be supplied.

For example:

rootCmd.Flags().StringVarP(&authToken, "auth-token", "t", "", "Authentication token (required if password is not set)")
rootCmd.Flags().StringVarP(&pw, "password", "p", "", "Password (required if authentication token is not set)")
rootCmd.MarkFlagsMutuallyExclusiveRequired("auth-token", "password")

@CLAassistant
Copy link

CLAassistant commented Jul 2, 2022

CLA assistant check
All committers have signed the CLA.

@github-actions github-actions bot added the size/M Denotes a PR that chanes 24-99 lines label Jul 2, 2022
@lavafroth lavafroth closed this by deleting the head repository Aug 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/M Denotes a PR that chanes 24-99 lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants