-
Notifications
You must be signed in to change notification settings - Fork 588
cli: fix builder persistent flag #818
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
Conversation
|
It is somewhat nice though that you can do |
|
will instead hide the builder flags for subcommand that don't need it as discussed. |
5f7b3df to
aa76c21
Compare
| // 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) |
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.
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.
commands/imagetools/inspect.go
Outdated
|
|
||
| _ = flags | ||
| // hide builder persistent flag for this command | ||
| cobrautil.HideInheritedFlags(cmd, "builder") |
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.
I found an use-case for this in #825
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.
rebased since latest changes
aa76c21 to
2d76372
Compare
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2d76372 to
eab0e6a
Compare

Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.

--builderflag should not be persistent for all subcommands.Before
Now
Signed-off-by: CrazyMax crazy-max@users.noreply.github.com