|
|
@ -237,9 +237,10 @@ func (f IntSliceFlag) getName() string {
|
|
|
|
|
|
|
|
|
|
|
|
// BoolFlag is a switch that defaults to false
|
|
|
|
// BoolFlag is a switch that defaults to false
|
|
|
|
type BoolFlag struct {
|
|
|
|
type BoolFlag struct {
|
|
|
|
Name string
|
|
|
|
Name string
|
|
|
|
Usage string
|
|
|
|
Usage string
|
|
|
|
EnvVar string
|
|
|
|
EnvVar string
|
|
|
|
|
|
|
|
Destination *bool
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// String returns a readable representation of this value (for usage defaults)
|
|
|
|
// String returns a readable representation of this value (for usage defaults)
|
|
|
@ -264,6 +265,10 @@ func (f BoolFlag) Apply(set *flag.FlagSet) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
eachName(f.Name, func(name string) {
|
|
|
|
eachName(f.Name, func(name string) {
|
|
|
|
|
|
|
|
if f.Destination != nil {
|
|
|
|
|
|
|
|
set.BoolVar(f.Destination, name, val, f.Usage)
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
}
|
|
|
|
set.Bool(name, val, f.Usage)
|
|
|
|
set.Bool(name, val, f.Usage)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -275,9 +280,10 @@ func (f BoolFlag) getName() string {
|
|
|
|
// BoolTFlag this represents a boolean flag that is true by default, but can
|
|
|
|
// BoolTFlag this represents a boolean flag that is true by default, but can
|
|
|
|
// still be set to false by --some-flag=false
|
|
|
|
// still be set to false by --some-flag=false
|
|
|
|
type BoolTFlag struct {
|
|
|
|
type BoolTFlag struct {
|
|
|
|
Name string
|
|
|
|
Name string
|
|
|
|
Usage string
|
|
|
|
Usage string
|
|
|
|
EnvVar string
|
|
|
|
EnvVar string
|
|
|
|
|
|
|
|
Destination *bool
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// String returns a readable representation of this value (for usage defaults)
|
|
|
|
// String returns a readable representation of this value (for usage defaults)
|
|
|
@ -302,6 +308,10 @@ func (f BoolTFlag) Apply(set *flag.FlagSet) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
eachName(f.Name, func(name string) {
|
|
|
|
eachName(f.Name, func(name string) {
|
|
|
|
|
|
|
|
if f.Destination != nil {
|
|
|
|
|
|
|
|
set.BoolVar(f.Destination, name, val, f.Usage)
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
}
|
|
|
|
set.Bool(name, val, f.Usage)
|
|
|
|
set.Bool(name, val, f.Usage)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -312,10 +322,11 @@ func (f BoolTFlag) getName() string {
|
|
|
|
|
|
|
|
|
|
|
|
// StringFlag represents a flag that takes as string value
|
|
|
|
// StringFlag represents a flag that takes as string value
|
|
|
|
type StringFlag struct {
|
|
|
|
type StringFlag struct {
|
|
|
|
Name string
|
|
|
|
Name string
|
|
|
|
Value string
|
|
|
|
Value string
|
|
|
|
Usage string
|
|
|
|
Usage string
|
|
|
|
EnvVar string
|
|
|
|
EnvVar string
|
|
|
|
|
|
|
|
Destination *string
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// String returns the usage
|
|
|
|
// String returns the usage
|
|
|
@ -345,6 +356,10 @@ func (f StringFlag) Apply(set *flag.FlagSet) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
eachName(f.Name, func(name string) {
|
|
|
|
eachName(f.Name, func(name string) {
|
|
|
|
|
|
|
|
if f.Destination != nil {
|
|
|
|
|
|
|
|
set.StringVar(f.Destination, name, f.Value, f.Usage)
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
}
|
|
|
|
set.String(name, f.Value, f.Usage)
|
|
|
|
set.String(name, f.Value, f.Usage)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -356,10 +371,11 @@ func (f StringFlag) getName() string {
|
|
|
|
// IntFlag is a flag that takes an integer
|
|
|
|
// IntFlag is a flag that takes an integer
|
|
|
|
// Errors if the value provided cannot be parsed
|
|
|
|
// Errors if the value provided cannot be parsed
|
|
|
|
type IntFlag struct {
|
|
|
|
type IntFlag struct {
|
|
|
|
Name string
|
|
|
|
Name string
|
|
|
|
Value int
|
|
|
|
Value int
|
|
|
|
Usage string
|
|
|
|
Usage string
|
|
|
|
EnvVar string
|
|
|
|
EnvVar string
|
|
|
|
|
|
|
|
Destination *int
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// String returns the usage
|
|
|
|
// String returns the usage
|
|
|
@ -383,6 +399,10 @@ func (f IntFlag) Apply(set *flag.FlagSet) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
eachName(f.Name, func(name string) {
|
|
|
|
eachName(f.Name, func(name string) {
|
|
|
|
|
|
|
|
if f.Destination != nil {
|
|
|
|
|
|
|
|
set.IntVar(f.Destination, name, f.Value, f.Usage)
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
}
|
|
|
|
set.Int(name, f.Value, f.Usage)
|
|
|
|
set.Int(name, f.Value, f.Usage)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -394,10 +414,11 @@ func (f IntFlag) getName() string {
|
|
|
|
// DurationFlag is a flag that takes a duration specified in Go's duration
|
|
|
|
// DurationFlag is a flag that takes a duration specified in Go's duration
|
|
|
|
// format: https://golang.org/pkg/time/#ParseDuration
|
|
|
|
// format: https://golang.org/pkg/time/#ParseDuration
|
|
|
|
type DurationFlag struct {
|
|
|
|
type DurationFlag struct {
|
|
|
|
Name string
|
|
|
|
Name string
|
|
|
|
Value time.Duration
|
|
|
|
Value time.Duration
|
|
|
|
Usage string
|
|
|
|
Usage string
|
|
|
|
EnvVar string
|
|
|
|
EnvVar string
|
|
|
|
|
|
|
|
Destination *time.Duration
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// String returns a readable representation of this value (for usage defaults)
|
|
|
|
// String returns a readable representation of this value (for usage defaults)
|
|
|
@ -421,6 +442,10 @@ func (f DurationFlag) Apply(set *flag.FlagSet) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
eachName(f.Name, func(name string) {
|
|
|
|
eachName(f.Name, func(name string) {
|
|
|
|
|
|
|
|
if f.Destination != nil {
|
|
|
|
|
|
|
|
set.DurationVar(f.Destination, name, f.Value, f.Usage)
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
}
|
|
|
|
set.Duration(name, f.Value, f.Usage)
|
|
|
|
set.Duration(name, f.Value, f.Usage)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -432,10 +457,11 @@ func (f DurationFlag) getName() string {
|
|
|
|
// Float64Flag is a flag that takes an float value
|
|
|
|
// Float64Flag is a flag that takes an float value
|
|
|
|
// Errors if the value provided cannot be parsed
|
|
|
|
// Errors if the value provided cannot be parsed
|
|
|
|
type Float64Flag struct {
|
|
|
|
type Float64Flag struct {
|
|
|
|
Name string
|
|
|
|
Name string
|
|
|
|
Value float64
|
|
|
|
Value float64
|
|
|
|
Usage string
|
|
|
|
Usage string
|
|
|
|
EnvVar string
|
|
|
|
EnvVar string
|
|
|
|
|
|
|
|
Destination *float64
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// String returns the usage
|
|
|
|
// String returns the usage
|
|
|
@ -458,6 +484,10 @@ func (f Float64Flag) Apply(set *flag.FlagSet) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
eachName(f.Name, func(name string) {
|
|
|
|
eachName(f.Name, func(name string) {
|
|
|
|
|
|
|
|
if f.Destination != nil {
|
|
|
|
|
|
|
|
set.Float64Var(f.Destination, name, f.Value, f.Usage)
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
}
|
|
|
|
set.Float64(name, f.Value, f.Usage)
|
|
|
|
set.Float64(name, f.Value, f.Usage)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|