mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-06 16:06:51 +00:00
Make "BoolFlag" booleans not require =true
This commit is contained in:
@@ -22,8 +22,9 @@ import (
|
||||
)
|
||||
|
||||
// BoolFlag is a boolean flag compatible with flags and pflags that keeps track of whether it had a value supplied or not.
|
||||
// Beware! If you use this type, you must actually specify --flag-name=true, you cannot leave it as --flag-name and still have
|
||||
// the value set
|
||||
// Getting this flag to act like a normal bool, where true/false are not required needs a little bit of extra code, example:
|
||||
// f := cmd.Flags().VarPF(&BoolFlagVar, "flagname", "", "help about the flag")
|
||||
// f.NoOptDefVal = "true"
|
||||
type BoolFlag struct {
|
||||
// If Set has been invoked this value is true
|
||||
provided bool
|
||||
|
||||
Reference in New Issue
Block a user