From bc9ad9fede4d530aaec478c0dc21edcdfc8b1b6a Mon Sep 17 00:00:00 2001 From: Dan Buch Date: Sun, 8 May 2022 13:52:32 -0400 Subject: [PATCH] Generate RequiredFlag and VisibleFlag implementations --- flag_bool.go | 10 -- flag_duration.go | 10 -- flag_float64.go | 10 -- flag_float64_slice.go | 10 -- flag_generic.go | 10 -- flag_int.go | 10 -- flag_int64.go | 10 -- flag_int64_slice.go | 10 -- flag_int_slice.go | 10 -- flag_path.go | 10 -- flag_string.go | 10 -- flag_string_slice.go | 10 -- flag_timestamp.go | 10 -- flag_uint.go | 10 -- flag_uint64.go | 10 -- internal/genflags/generated.gotmpl | 16 ++- internal/genflags/generated_test.gotmpl | 16 +++ internal/genflags/spec.go | 8 ++ zz_generated.flags.go | 150 ++++++++++++++++++++ zz_generated.flags_test.go | 180 ++++++++++++++++++++++++ 20 files changed, 369 insertions(+), 151 deletions(-) diff --git a/flag_bool.go b/flag_bool.go index f984acf..1277504 100644 --- a/flag_bool.go +++ b/flag_bool.go @@ -6,11 +6,6 @@ import ( "strconv" ) -// IsRequired returns whether or not the flag is required -func (f *BoolFlag) IsRequired() bool { - return f.Required -} - // TakesValue returns true of the flag takes a value, otherwise false func (f *BoolFlag) TakesValue() bool { return false @@ -27,11 +22,6 @@ func (f *BoolFlag) GetValue() string { return "" } -// IsVisible returns true if the flag is not hidden, otherwise false -func (f *BoolFlag) IsVisible() bool { - return !f.Hidden -} - // GetDefaultText returns the default text for this flag func (f *BoolFlag) GetDefaultText() string { if f.DefaultText != "" { diff --git a/flag_duration.go b/flag_duration.go index a6677ad..236056c 100644 --- a/flag_duration.go +++ b/flag_duration.go @@ -6,11 +6,6 @@ import ( "time" ) -// IsRequired returns whether or not the flag is required -func (f *DurationFlag) IsRequired() bool { - return f.Required -} - // TakesValue returns true of the flag takes a value, otherwise false func (f *DurationFlag) TakesValue() bool { return true @@ -27,11 +22,6 @@ func (f *DurationFlag) GetValue() string { return f.Value.String() } -// IsVisible returns true if the flag is not hidden, otherwise false -func (f *DurationFlag) IsVisible() bool { - return !f.Hidden -} - // GetDefaultText returns the default text for this flag func (f *DurationFlag) GetDefaultText() string { if f.DefaultText != "" { diff --git a/flag_float64.go b/flag_float64.go index 62a1973..aa2f359 100644 --- a/flag_float64.go +++ b/flag_float64.go @@ -6,11 +6,6 @@ import ( "strconv" ) -// IsRequired returns whether or not the flag is required -func (f *Float64Flag) IsRequired() bool { - return f.Required -} - // TakesValue returns true of the flag takes a value, otherwise false func (f *Float64Flag) TakesValue() bool { return true @@ -40,11 +35,6 @@ func (f *Float64Flag) GetEnvVars() []string { return f.EnvVars } -// IsVisible returns true if the flag is not hidden, otherwise false -func (f *Float64Flag) IsVisible() bool { - return !f.Hidden -} - // Apply populates the flag given the flag set and environment func (f *Float64Flag) Apply(set *flag.FlagSet) error { if val, ok := flagFromEnvOrFile(f.EnvVars, f.FilePath); ok { diff --git a/flag_float64_slice.go b/flag_float64_slice.go index 0f09c8c..e2bfc4c 100644 --- a/flag_float64_slice.go +++ b/flag_float64_slice.go @@ -81,11 +81,6 @@ func (f *Float64SliceFlag) String() string { return withEnvHint(f.GetEnvVars(), stringifyFloat64SliceFlag(f)) } -// IsRequired returns whether or not the flag is required -func (f *Float64SliceFlag) IsRequired() bool { - return f.Required -} - // TakesValue returns true if the flag takes a value, otherwise false func (f *Float64SliceFlag) TakesValue() bool { return true @@ -105,11 +100,6 @@ func (f *Float64SliceFlag) GetValue() string { return "" } -// IsVisible returns true if the flag is not hidden, otherwise false -func (f *Float64SliceFlag) IsVisible() bool { - return !f.Hidden -} - // GetDefaultText returns the default text for this flag func (f *Float64SliceFlag) GetDefaultText() string { if f.DefaultText != "" { diff --git a/flag_generic.go b/flag_generic.go index 71e7173..8be32b8 100644 --- a/flag_generic.go +++ b/flag_generic.go @@ -11,11 +11,6 @@ type Generic interface { String() string } -// IsRequired returns whether or not the flag is required -func (f *GenericFlag) IsRequired() bool { - return f.Required -} - // TakesValue returns true of the flag takes a value, otherwise false func (f *GenericFlag) TakesValue() bool { return true @@ -35,11 +30,6 @@ func (f *GenericFlag) GetValue() string { return "" } -// IsVisible returns true if the flag is not hidden, otherwise false -func (f *GenericFlag) IsVisible() bool { - return !f.Hidden -} - // GetDefaultText returns the default text for this flag func (f *GenericFlag) GetDefaultText() string { if f.DefaultText != "" { diff --git a/flag_int.go b/flag_int.go index b68c3e8..3f5dec5 100644 --- a/flag_int.go +++ b/flag_int.go @@ -6,11 +6,6 @@ import ( "strconv" ) -// IsRequired returns whether or not the flag is required -func (f *IntFlag) IsRequired() bool { - return f.Required -} - // TakesValue returns true of the flag takes a value, otherwise false func (f *IntFlag) TakesValue() bool { return true @@ -27,11 +22,6 @@ func (f *IntFlag) GetValue() string { return fmt.Sprintf("%d", f.Value) } -// IsVisible returns true if the flag is not hidden, otherwise false -func (f *IntFlag) IsVisible() bool { - return !f.Hidden -} - // GetDefaultText returns the default text for this flag func (f *IntFlag) GetDefaultText() string { if f.DefaultText != "" { diff --git a/flag_int64.go b/flag_int64.go index 3f71134..d005866 100644 --- a/flag_int64.go +++ b/flag_int64.go @@ -6,11 +6,6 @@ import ( "strconv" ) -// IsRequired returns whether or not the flag is required -func (f *Int64Flag) IsRequired() bool { - return f.Required -} - // TakesValue returns true of the flag takes a value, otherwise false func (f *Int64Flag) TakesValue() bool { return true @@ -27,11 +22,6 @@ func (f *Int64Flag) GetValue() string { return fmt.Sprintf("%d", f.Value) } -// IsVisible returns true if the flag is not hidden, otherwise false -func (f *Int64Flag) IsVisible() bool { - return !f.Hidden -} - // GetDefaultText returns the default text for this flag func (f *Int64Flag) GetDefaultText() string { if f.DefaultText != "" { diff --git a/flag_int64_slice.go b/flag_int64_slice.go index 14d8c41..b61bd7f 100644 --- a/flag_int64_slice.go +++ b/flag_int64_slice.go @@ -82,11 +82,6 @@ func (f *Int64SliceFlag) String() string { return withEnvHint(f.GetEnvVars(), stringifyInt64SliceFlag(f)) } -// IsRequired returns whether or not the flag is required -func (f *Int64SliceFlag) IsRequired() bool { - return f.Required -} - // TakesValue returns true of the flag takes a value, otherwise false func (f *Int64SliceFlag) TakesValue() bool { return true @@ -106,11 +101,6 @@ func (f *Int64SliceFlag) GetValue() string { return "" } -// IsVisible returns true if the flag is not hidden, otherwise false -func (f *Int64SliceFlag) IsVisible() bool { - return !f.Hidden -} - // GetDefaultText returns the default text for this flag func (f *Int64SliceFlag) GetDefaultText() string { if f.DefaultText != "" { diff --git a/flag_int_slice.go b/flag_int_slice.go index 4ed7f2c..f9713cc 100644 --- a/flag_int_slice.go +++ b/flag_int_slice.go @@ -93,11 +93,6 @@ func (f *IntSliceFlag) String() string { return withEnvHint(f.GetEnvVars(), stringifyIntSliceFlag(f)) } -// IsRequired returns whether or not the flag is required -func (f *IntSliceFlag) IsRequired() bool { - return f.Required -} - // TakesValue returns true of the flag takes a value, otherwise false func (f *IntSliceFlag) TakesValue() bool { return true @@ -117,11 +112,6 @@ func (f *IntSliceFlag) GetValue() string { return "" } -// IsVisible returns true if the flag is not hidden, otherwise false -func (f *IntSliceFlag) IsVisible() bool { - return !f.Hidden -} - // GetDefaultText returns the default text for this flag func (f *IntSliceFlag) GetDefaultText() string { if f.DefaultText != "" { diff --git a/flag_path.go b/flag_path.go index 095a596..b0c2215 100644 --- a/flag_path.go +++ b/flag_path.go @@ -7,11 +7,6 @@ import ( type Path = string -// IsRequired returns whether or not the flag is required -func (f *PathFlag) IsRequired() bool { - return f.Required -} - // TakesValue returns true of the flag takes a value, otherwise false func (f *PathFlag) TakesValue() bool { return true @@ -28,11 +23,6 @@ func (f *PathFlag) GetValue() string { return f.Value } -// IsVisible returns true if the flag is not hidden, otherwise false -func (f *PathFlag) IsVisible() bool { - return !f.Hidden -} - // GetDefaultText returns the default text for this flag func (f *PathFlag) GetDefaultText() string { if f.DefaultText != "" { diff --git a/flag_string.go b/flag_string.go index 4831c17..24adbe9 100644 --- a/flag_string.go +++ b/flag_string.go @@ -5,11 +5,6 @@ import ( "fmt" ) -// IsRequired returns whether or not the flag is required -func (f *StringFlag) IsRequired() bool { - return f.Required -} - // TakesValue returns true of the flag takes a value, otherwise false func (f *StringFlag) TakesValue() bool { return true @@ -26,11 +21,6 @@ func (f *StringFlag) GetValue() string { return f.Value } -// IsVisible returns true if the flag is not hidden, otherwise false -func (f *StringFlag) IsVisible() bool { - return !f.Hidden -} - // GetDefaultText returns the default text for this flag func (f *StringFlag) GetDefaultText() string { if f.DefaultText != "" { diff --git a/flag_string_slice.go b/flag_string_slice.go index 9e69d00..d0195d5 100644 --- a/flag_string_slice.go +++ b/flag_string_slice.go @@ -76,11 +76,6 @@ func (f *StringSliceFlag) String() string { return withEnvHint(f.GetEnvVars(), stringifyStringSliceFlag(f)) } -// IsRequired returns whether or not the flag is required -func (f *StringSliceFlag) IsRequired() bool { - return f.Required -} - // TakesValue returns true of the flag takes a value, otherwise false func (f *StringSliceFlag) TakesValue() bool { return true @@ -100,11 +95,6 @@ func (f *StringSliceFlag) GetValue() string { return "" } -// IsVisible returns true if the flag is not hidden, otherwise false -func (f *StringSliceFlag) IsVisible() bool { - return !f.Hidden -} - // GetDefaultText returns the default text for this flag func (f *StringSliceFlag) GetDefaultText() string { if f.DefaultText != "" { diff --git a/flag_timestamp.go b/flag_timestamp.go index 32899f5..ed480cf 100644 --- a/flag_timestamp.go +++ b/flag_timestamp.go @@ -58,11 +58,6 @@ func (t *Timestamp) Get() interface{} { return *t } -// IsRequired returns whether or not the flag is required -func (f *TimestampFlag) IsRequired() bool { - return f.Required -} - // TakesValue returns true of the flag takes a value, otherwise false func (f *TimestampFlag) TakesValue() bool { return true @@ -82,11 +77,6 @@ func (f *TimestampFlag) GetValue() string { return "" } -// IsVisible returns true if the flag is not hidden, otherwise false -func (f *TimestampFlag) IsVisible() bool { - return !f.Hidden -} - // GetDefaultText returns the default text for this flag func (f *TimestampFlag) GetDefaultText() string { if f.DefaultText != "" { diff --git a/flag_uint.go b/flag_uint.go index 625f11c..1ec9713 100644 --- a/flag_uint.go +++ b/flag_uint.go @@ -6,11 +6,6 @@ import ( "strconv" ) -// IsRequired returns whether or not the flag is required -func (f *UintFlag) IsRequired() bool { - return f.Required -} - // TakesValue returns true of the flag takes a value, otherwise false func (f *UintFlag) TakesValue() bool { return true @@ -21,11 +16,6 @@ func (f *UintFlag) GetUsage() string { return f.Usage } -// IsVisible returns true if the flag is not hidden, otherwise false -func (f *UintFlag) IsVisible() bool { - return !f.Hidden -} - // Apply populates the flag given the flag set and environment func (f *UintFlag) Apply(set *flag.FlagSet) error { if val, ok := flagFromEnvOrFile(f.EnvVars, f.FilePath); ok { diff --git a/flag_uint64.go b/flag_uint64.go index 58969a5..55ba08a 100644 --- a/flag_uint64.go +++ b/flag_uint64.go @@ -6,11 +6,6 @@ import ( "strconv" ) -// IsRequired returns whether or not the flag is required -func (f *Uint64Flag) IsRequired() bool { - return f.Required -} - // TakesValue returns true of the flag takes a value, otherwise false func (f *Uint64Flag) TakesValue() bool { return true @@ -21,11 +16,6 @@ func (f *Uint64Flag) GetUsage() string { return f.Usage } -// IsVisible returns true if the flag is not hidden, otherwise false -func (f *Uint64Flag) IsVisible() bool { - return !f.Hidden -} - // Apply populates the flag given the flag set and environment func (f *Uint64Flag) Apply(set *flag.FlagSet) error { if val, ok := flagFromEnvOrFile(f.EnvVars, f.FilePath); ok { diff --git a/internal/genflags/generated.gotmpl b/internal/genflags/generated.gotmpl index 5d6f0dd..99c292a 100644 --- a/internal/genflags/generated.gotmpl +++ b/internal/genflags/generated.gotmpl @@ -31,7 +31,7 @@ type {{.TypeName}} struct { func (f *{{.TypeName}}) String() string { return {{$.UrfaveCLINamespace}}FlagStringer(f) } -{{end}} +{{end}}{{/* /if .GenerateFmtStringerInterface */}} {{if .GenerateFlagInterface}} // IsSet returns whether or not the flag has been set through env or file @@ -45,6 +45,20 @@ func (f *{{.TypeName}}) Names() []string { } {{end}}{{/* /if .GenerateFlagInterface */}} + +{{if .GenerateRequiredFlagInterface}} +// IsRequired returns whether or not the flag is required +func (f *{{.TypeName}}) IsRequired() bool { + return f.Required +} +{{end}}{{/* /if .GenerateRequiredFlagInterface */}} + +{{if .GenerateVisibleFlagInterface}} +// IsVisible returns true if the flag is not hidden, otherwise false +func (f *{{.TypeName}}) IsVisible() bool { + return !f.Hidden +} +{{end}}{{/* /if .GenerateVisibleFlagInterface */}} {{end}}{{/* /range .SortedFlagTypes */}} // vim{{/* 👻 */}}:ro diff --git a/internal/genflags/generated_test.gotmpl b/internal/genflags/generated_test.gotmpl index 44e9ad4..52de4e4 100644 --- a/internal/genflags/generated_test.gotmpl +++ b/internal/genflags/generated_test.gotmpl @@ -19,6 +19,22 @@ func Test{{.TypeName}}_SatisfiesFmtStringerInterface(t *testing.T) { _ = f.String() } {{end}} + +{{if .GenerateRequiredFlagInterface}} +func Test{{.TypeName}}_SatisfiesRequiredFlagInterface(t *testing.T) { + var f {{$.UrfaveCLITestNamespace}}RequiredFlag = &{{$.UrfaveCLITestNamespace}}{{.TypeName}}{} + + _ = f.IsRequired() +} +{{end}} + +{{if .GenerateVisibleFlagInterface}} +func Test{{.TypeName}}_SatisfiesVisibleFlagInterface(t *testing.T) { + var f {{$.UrfaveCLITestNamespace}}VisibleFlag = &{{$.UrfaveCLITestNamespace}}{{.TypeName}}{} + + _ = f.IsVisible() +} +{{end}} {{end}} // vim{{/* 👻 */}}:ro diff --git a/internal/genflags/spec.go b/internal/genflags/spec.go index d9f18db..a7afb22 100644 --- a/internal/genflags/spec.go +++ b/internal/genflags/spec.go @@ -83,6 +83,14 @@ func (ft *FlagType) GenerateFlagInterface() bool { return ft.skipInterfaceNamed("Flag") } +func (ft *FlagType) GenerateRequiredFlagInterface() bool { + return ft.skipInterfaceNamed("RequiredFlag") +} + +func (ft *FlagType) GenerateVisibleFlagInterface() bool { + return ft.skipInterfaceNamed("VisibleFlag") +} + func (ft *FlagType) skipInterfaceNamed(name string) bool { if ft.Config == nil { return true diff --git a/zz_generated.flags.go b/zz_generated.flags.go index 703e66a..6c16c3e 100644 --- a/zz_generated.flags.go +++ b/zz_generated.flags.go @@ -33,6 +33,16 @@ func (f *Float64SliceFlag) Names() []string { return FlagNames(f.Name, f.Aliases) } +// IsRequired returns whether or not the flag is required +func (f *Float64SliceFlag) IsRequired() bool { + return f.Required +} + +// IsVisible returns true if the flag is not hidden, otherwise false +func (f *Float64SliceFlag) IsVisible() bool { + return !f.Hidden +} + // GenericFlag is a flag with type Generic type GenericFlag struct { Name string @@ -69,6 +79,16 @@ func (f *GenericFlag) Names() []string { return FlagNames(f.Name, f.Aliases) } +// IsRequired returns whether or not the flag is required +func (f *GenericFlag) IsRequired() bool { + return f.Required +} + +// IsVisible returns true if the flag is not hidden, otherwise false +func (f *GenericFlag) IsVisible() bool { + return !f.Hidden +} + // Int64SliceFlag is a flag with type *Int64Slice type Int64SliceFlag struct { Name string @@ -98,6 +118,16 @@ func (f *Int64SliceFlag) Names() []string { return FlagNames(f.Name, f.Aliases) } +// IsRequired returns whether or not the flag is required +func (f *Int64SliceFlag) IsRequired() bool { + return f.Required +} + +// IsVisible returns true if the flag is not hidden, otherwise false +func (f *Int64SliceFlag) IsVisible() bool { + return !f.Hidden +} + // IntSliceFlag is a flag with type *IntSlice type IntSliceFlag struct { Name string @@ -127,6 +157,16 @@ func (f *IntSliceFlag) Names() []string { return FlagNames(f.Name, f.Aliases) } +// IsRequired returns whether or not the flag is required +func (f *IntSliceFlag) IsRequired() bool { + return f.Required +} + +// IsVisible returns true if the flag is not hidden, otherwise false +func (f *IntSliceFlag) IsVisible() bool { + return !f.Hidden +} + // PathFlag is a flag with type Path type PathFlag struct { Name string @@ -163,6 +203,16 @@ func (f *PathFlag) Names() []string { return FlagNames(f.Name, f.Aliases) } +// IsRequired returns whether or not the flag is required +func (f *PathFlag) IsRequired() bool { + return f.Required +} + +// IsVisible returns true if the flag is not hidden, otherwise false +func (f *PathFlag) IsVisible() bool { + return !f.Hidden +} + // StringSliceFlag is a flag with type *StringSlice type StringSliceFlag struct { Name string @@ -194,6 +244,16 @@ func (f *StringSliceFlag) Names() []string { return FlagNames(f.Name, f.Aliases) } +// IsRequired returns whether or not the flag is required +func (f *StringSliceFlag) IsRequired() bool { + return f.Required +} + +// IsVisible returns true if the flag is not hidden, otherwise false +func (f *StringSliceFlag) IsVisible() bool { + return !f.Hidden +} + // TimestampFlag is a flag with type *Timestamp type TimestampFlag struct { Name string @@ -230,6 +290,16 @@ func (f *TimestampFlag) Names() []string { return FlagNames(f.Name, f.Aliases) } +// IsRequired returns whether or not the flag is required +func (f *TimestampFlag) IsRequired() bool { + return f.Required +} + +// IsVisible returns true if the flag is not hidden, otherwise false +func (f *TimestampFlag) IsVisible() bool { + return !f.Hidden +} + // BoolFlag is a flag with type bool type BoolFlag struct { Name string @@ -264,6 +334,16 @@ func (f *BoolFlag) Names() []string { return FlagNames(f.Name, f.Aliases) } +// IsRequired returns whether or not the flag is required +func (f *BoolFlag) IsRequired() bool { + return f.Required +} + +// IsVisible returns true if the flag is not hidden, otherwise false +func (f *BoolFlag) IsVisible() bool { + return !f.Hidden +} + // Float64Flag is a flag with type float64 type Float64Flag struct { Name string @@ -298,6 +378,16 @@ func (f *Float64Flag) Names() []string { return FlagNames(f.Name, f.Aliases) } +// IsRequired returns whether or not the flag is required +func (f *Float64Flag) IsRequired() bool { + return f.Required +} + +// IsVisible returns true if the flag is not hidden, otherwise false +func (f *Float64Flag) IsVisible() bool { + return !f.Hidden +} + // IntFlag is a flag with type int type IntFlag struct { Name string @@ -332,6 +422,16 @@ func (f *IntFlag) Names() []string { return FlagNames(f.Name, f.Aliases) } +// IsRequired returns whether or not the flag is required +func (f *IntFlag) IsRequired() bool { + return f.Required +} + +// IsVisible returns true if the flag is not hidden, otherwise false +func (f *IntFlag) IsVisible() bool { + return !f.Hidden +} + // Int64Flag is a flag with type int64 type Int64Flag struct { Name string @@ -366,6 +466,16 @@ func (f *Int64Flag) Names() []string { return FlagNames(f.Name, f.Aliases) } +// IsRequired returns whether or not the flag is required +func (f *Int64Flag) IsRequired() bool { + return f.Required +} + +// IsVisible returns true if the flag is not hidden, otherwise false +func (f *Int64Flag) IsVisible() bool { + return !f.Hidden +} + // StringFlag is a flag with type string type StringFlag struct { Name string @@ -402,6 +512,16 @@ func (f *StringFlag) Names() []string { return FlagNames(f.Name, f.Aliases) } +// IsRequired returns whether or not the flag is required +func (f *StringFlag) IsRequired() bool { + return f.Required +} + +// IsVisible returns true if the flag is not hidden, otherwise false +func (f *StringFlag) IsVisible() bool { + return !f.Hidden +} + // DurationFlag is a flag with type time.Duration type DurationFlag struct { Name string @@ -436,6 +556,16 @@ func (f *DurationFlag) Names() []string { return FlagNames(f.Name, f.Aliases) } +// IsRequired returns whether or not the flag is required +func (f *DurationFlag) IsRequired() bool { + return f.Required +} + +// IsVisible returns true if the flag is not hidden, otherwise false +func (f *DurationFlag) IsVisible() bool { + return !f.Hidden +} + // UintFlag is a flag with type uint type UintFlag struct { Name string @@ -470,6 +600,16 @@ func (f *UintFlag) Names() []string { return FlagNames(f.Name, f.Aliases) } +// IsRequired returns whether or not the flag is required +func (f *UintFlag) IsRequired() bool { + return f.Required +} + +// IsVisible returns true if the flag is not hidden, otherwise false +func (f *UintFlag) IsVisible() bool { + return !f.Hidden +} + // Uint64Flag is a flag with type uint64 type Uint64Flag struct { Name string @@ -504,4 +644,14 @@ func (f *Uint64Flag) Names() []string { return FlagNames(f.Name, f.Aliases) } +// IsRequired returns whether or not the flag is required +func (f *Uint64Flag) IsRequired() bool { + return f.Required +} + +// IsVisible returns true if the flag is not hidden, otherwise false +func (f *Uint64Flag) IsVisible() bool { + return !f.Hidden +} + // vim:ro diff --git a/zz_generated.flags_test.go b/zz_generated.flags_test.go index b8363d4..1d9afda 100644 --- a/zz_generated.flags_test.go +++ b/zz_generated.flags_test.go @@ -16,6 +16,18 @@ func TestFloat64SliceFlag_SatisfiesFlagInterface(t *testing.T) { _ = f.Names() } +func TestFloat64SliceFlag_SatisfiesRequiredFlagInterface(t *testing.T) { + var f cli.RequiredFlag = &cli.Float64SliceFlag{} + + _ = f.IsRequired() +} + +func TestFloat64SliceFlag_SatisfiesVisibleFlagInterface(t *testing.T) { + var f cli.VisibleFlag = &cli.Float64SliceFlag{} + + _ = f.IsVisible() +} + func TestGenericFlag_SatisfiesFlagInterface(t *testing.T) { var f cli.Flag = &cli.GenericFlag{} @@ -29,6 +41,18 @@ func TestGenericFlag_SatisfiesFmtStringerInterface(t *testing.T) { _ = f.String() } +func TestGenericFlag_SatisfiesRequiredFlagInterface(t *testing.T) { + var f cli.RequiredFlag = &cli.GenericFlag{} + + _ = f.IsRequired() +} + +func TestGenericFlag_SatisfiesVisibleFlagInterface(t *testing.T) { + var f cli.VisibleFlag = &cli.GenericFlag{} + + _ = f.IsVisible() +} + func TestInt64SliceFlag_SatisfiesFlagInterface(t *testing.T) { var f cli.Flag = &cli.Int64SliceFlag{} @@ -36,6 +60,18 @@ func TestInt64SliceFlag_SatisfiesFlagInterface(t *testing.T) { _ = f.Names() } +func TestInt64SliceFlag_SatisfiesRequiredFlagInterface(t *testing.T) { + var f cli.RequiredFlag = &cli.Int64SliceFlag{} + + _ = f.IsRequired() +} + +func TestInt64SliceFlag_SatisfiesVisibleFlagInterface(t *testing.T) { + var f cli.VisibleFlag = &cli.Int64SliceFlag{} + + _ = f.IsVisible() +} + func TestIntSliceFlag_SatisfiesFlagInterface(t *testing.T) { var f cli.Flag = &cli.IntSliceFlag{} @@ -43,6 +79,18 @@ func TestIntSliceFlag_SatisfiesFlagInterface(t *testing.T) { _ = f.Names() } +func TestIntSliceFlag_SatisfiesRequiredFlagInterface(t *testing.T) { + var f cli.RequiredFlag = &cli.IntSliceFlag{} + + _ = f.IsRequired() +} + +func TestIntSliceFlag_SatisfiesVisibleFlagInterface(t *testing.T) { + var f cli.VisibleFlag = &cli.IntSliceFlag{} + + _ = f.IsVisible() +} + func TestPathFlag_SatisfiesFlagInterface(t *testing.T) { var f cli.Flag = &cli.PathFlag{} @@ -56,6 +104,18 @@ func TestPathFlag_SatisfiesFmtStringerInterface(t *testing.T) { _ = f.String() } +func TestPathFlag_SatisfiesRequiredFlagInterface(t *testing.T) { + var f cli.RequiredFlag = &cli.PathFlag{} + + _ = f.IsRequired() +} + +func TestPathFlag_SatisfiesVisibleFlagInterface(t *testing.T) { + var f cli.VisibleFlag = &cli.PathFlag{} + + _ = f.IsVisible() +} + func TestStringSliceFlag_SatisfiesFlagInterface(t *testing.T) { var f cli.Flag = &cli.StringSliceFlag{} @@ -63,6 +123,18 @@ func TestStringSliceFlag_SatisfiesFlagInterface(t *testing.T) { _ = f.Names() } +func TestStringSliceFlag_SatisfiesRequiredFlagInterface(t *testing.T) { + var f cli.RequiredFlag = &cli.StringSliceFlag{} + + _ = f.IsRequired() +} + +func TestStringSliceFlag_SatisfiesVisibleFlagInterface(t *testing.T) { + var f cli.VisibleFlag = &cli.StringSliceFlag{} + + _ = f.IsVisible() +} + func TestTimestampFlag_SatisfiesFlagInterface(t *testing.T) { var f cli.Flag = &cli.TimestampFlag{} @@ -76,6 +148,18 @@ func TestTimestampFlag_SatisfiesFmtStringerInterface(t *testing.T) { _ = f.String() } +func TestTimestampFlag_SatisfiesRequiredFlagInterface(t *testing.T) { + var f cli.RequiredFlag = &cli.TimestampFlag{} + + _ = f.IsRequired() +} + +func TestTimestampFlag_SatisfiesVisibleFlagInterface(t *testing.T) { + var f cli.VisibleFlag = &cli.TimestampFlag{} + + _ = f.IsVisible() +} + func TestBoolFlag_SatisfiesFlagInterface(t *testing.T) { var f cli.Flag = &cli.BoolFlag{} @@ -89,6 +173,18 @@ func TestBoolFlag_SatisfiesFmtStringerInterface(t *testing.T) { _ = f.String() } +func TestBoolFlag_SatisfiesRequiredFlagInterface(t *testing.T) { + var f cli.RequiredFlag = &cli.BoolFlag{} + + _ = f.IsRequired() +} + +func TestBoolFlag_SatisfiesVisibleFlagInterface(t *testing.T) { + var f cli.VisibleFlag = &cli.BoolFlag{} + + _ = f.IsVisible() +} + func TestFloat64Flag_SatisfiesFlagInterface(t *testing.T) { var f cli.Flag = &cli.Float64Flag{} @@ -102,6 +198,18 @@ func TestFloat64Flag_SatisfiesFmtStringerInterface(t *testing.T) { _ = f.String() } +func TestFloat64Flag_SatisfiesRequiredFlagInterface(t *testing.T) { + var f cli.RequiredFlag = &cli.Float64Flag{} + + _ = f.IsRequired() +} + +func TestFloat64Flag_SatisfiesVisibleFlagInterface(t *testing.T) { + var f cli.VisibleFlag = &cli.Float64Flag{} + + _ = f.IsVisible() +} + func TestIntFlag_SatisfiesFlagInterface(t *testing.T) { var f cli.Flag = &cli.IntFlag{} @@ -115,6 +223,18 @@ func TestIntFlag_SatisfiesFmtStringerInterface(t *testing.T) { _ = f.String() } +func TestIntFlag_SatisfiesRequiredFlagInterface(t *testing.T) { + var f cli.RequiredFlag = &cli.IntFlag{} + + _ = f.IsRequired() +} + +func TestIntFlag_SatisfiesVisibleFlagInterface(t *testing.T) { + var f cli.VisibleFlag = &cli.IntFlag{} + + _ = f.IsVisible() +} + func TestInt64Flag_SatisfiesFlagInterface(t *testing.T) { var f cli.Flag = &cli.Int64Flag{} @@ -128,6 +248,18 @@ func TestInt64Flag_SatisfiesFmtStringerInterface(t *testing.T) { _ = f.String() } +func TestInt64Flag_SatisfiesRequiredFlagInterface(t *testing.T) { + var f cli.RequiredFlag = &cli.Int64Flag{} + + _ = f.IsRequired() +} + +func TestInt64Flag_SatisfiesVisibleFlagInterface(t *testing.T) { + var f cli.VisibleFlag = &cli.Int64Flag{} + + _ = f.IsVisible() +} + func TestStringFlag_SatisfiesFlagInterface(t *testing.T) { var f cli.Flag = &cli.StringFlag{} @@ -141,6 +273,18 @@ func TestStringFlag_SatisfiesFmtStringerInterface(t *testing.T) { _ = f.String() } +func TestStringFlag_SatisfiesRequiredFlagInterface(t *testing.T) { + var f cli.RequiredFlag = &cli.StringFlag{} + + _ = f.IsRequired() +} + +func TestStringFlag_SatisfiesVisibleFlagInterface(t *testing.T) { + var f cli.VisibleFlag = &cli.StringFlag{} + + _ = f.IsVisible() +} + func TestDurationFlag_SatisfiesFlagInterface(t *testing.T) { var f cli.Flag = &cli.DurationFlag{} @@ -154,6 +298,18 @@ func TestDurationFlag_SatisfiesFmtStringerInterface(t *testing.T) { _ = f.String() } +func TestDurationFlag_SatisfiesRequiredFlagInterface(t *testing.T) { + var f cli.RequiredFlag = &cli.DurationFlag{} + + _ = f.IsRequired() +} + +func TestDurationFlag_SatisfiesVisibleFlagInterface(t *testing.T) { + var f cli.VisibleFlag = &cli.DurationFlag{} + + _ = f.IsVisible() +} + func TestUintFlag_SatisfiesFlagInterface(t *testing.T) { var f cli.Flag = &cli.UintFlag{} @@ -167,6 +323,18 @@ func TestUintFlag_SatisfiesFmtStringerInterface(t *testing.T) { _ = f.String() } +func TestUintFlag_SatisfiesRequiredFlagInterface(t *testing.T) { + var f cli.RequiredFlag = &cli.UintFlag{} + + _ = f.IsRequired() +} + +func TestUintFlag_SatisfiesVisibleFlagInterface(t *testing.T) { + var f cli.VisibleFlag = &cli.UintFlag{} + + _ = f.IsVisible() +} + func TestUint64Flag_SatisfiesFlagInterface(t *testing.T) { var f cli.Flag = &cli.Uint64Flag{} @@ -180,4 +348,16 @@ func TestUint64Flag_SatisfiesFmtStringerInterface(t *testing.T) { _ = f.String() } +func TestUint64Flag_SatisfiesRequiredFlagInterface(t *testing.T) { + var f cli.RequiredFlag = &cli.Uint64Flag{} + + _ = f.IsRequired() +} + +func TestUint64Flag_SatisfiesVisibleFlagInterface(t *testing.T) { + var f cli.VisibleFlag = &cli.Uint64Flag{} + + _ = f.IsVisible() +} + // vim:ro