-
-
Notifications
You must be signed in to change notification settings - Fork 161
feat(cmd/issue/update): add --public and --confidential flags #396
Conversation
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.
Thanks @maxice8
Is there some documentation on how to add flags ? In agl I just have |
Cobra doesn't have any built-in function to restrict flag values so you would have to validate it yourself. |
Yes, in agl I just check with If one passes This is expressed in the code by the logic for the flag that can override being later so the condition for What I actually mean is there a guideline on new flags ? Should we have different |
You can but you should throw an error when both flags are specified. You can do this check if cmd.Flags().Changed("confidential") && cmd.Flags().Changed("public") {
return &cmdutil.FlagError{Err: errors.New("specify either of --public or --confidential")}
} Sorry, I think I approved this too soon. This check should be added instead of having one override the other. This should be safe. |
they allow making an issue public or confidential, as documented by GitLab here[1] and in their API[2] (see confidential field) [1]: https://docs.gitlab.com/ee/user/project/issues/confidential_issues.html [2]: https://docs.gitlab.com/ee/api/issues.html#edit-issue
Description
they allow making an issue public or confidential, as documented by
GitLab here1 and in their API2 (see confidential field)
Related Issue
Resolves #395
How Has This Been Tested?
Tested against the usecase presented in #395
Types of changes