mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-07-09 21:17:09 +08:00
cli: fix builder persistent flag
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
14
util/cobrautil/cobrautil.go
Normal file
14
util/cobrautil/cobrautil.go
Normal file
@ -0,0 +1,14 @@
|
||||
package cobrautil
|
||||
|
||||
import "github.com/spf13/cobra"
|
||||
|
||||
// HideInheritedFlags hides inherited flags
|
||||
func HideInheritedFlags(cmd *cobra.Command, hidden ...string) {
|
||||
for _, h := range hidden {
|
||||
// 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)
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user