cli: fix builder persistent flag#818
Merged
tonistiigi merged 1 commit intodocker:masterfrom Nov 4, 2021
Merged
Conversation
Member
|
It is somewhat nice though that you can do |
Member
Author
|
will instead hide the builder flags for subcommand that don't need it as discussed. |
5f7b3df to
aa76c21
Compare
crazy-max
commented
Nov 3, 2021
crazy-max
commented
Nov 3, 2021
Comment on lines
+8
to
+12
| // we could use cmd.SetHelpFunc to override the helper | ||
| // but, it's not enough because we also want the generated | ||
| // docs to be updated, so we override the flag instead | ||
| cmd.Flags().String(h, "", "") | ||
| _ = cmd.Flags().MarkHidden(h) |
Member
Author
There was a problem hiding this comment.
would have preferred to use SetHelpFunc like:
cmd.SetHelpFunc(func(ccmd *cobra.Command, args []string) {
for _, h := range hidden {
_ = ccmd.Flags().MarkHidden(h)
}
cmd.SetHelpFunc(nil)
cmd.HelpFunc()(ccmd, args)
})but it cannot be handled for docs generation unfortunately.
tonistiigi
reviewed
Nov 4, 2021
|
|
||
| _ = flags | ||
| // hide builder persistent flag for this command | ||
| cobrautil.HideInheritedFlags(cmd, "builder") |
Member
Author
There was a problem hiding this comment.
rebased since latest changes
aa76c21 to
2d76372
Compare
Signed-off-by: CrazyMax <[email protected]>
2d76372 to
eab0e6a
Compare
tonistiigi
approved these changes
Nov 4, 2021
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
--builderflag should not be persistent for all subcommands.Before
Now
Signed-off-by: CrazyMax [email protected]