remove manual isRequired funcs

main
Lynn Cyrin 5 years ago
parent 62e99ad1c1
commit 8a58b7e039
No known key found for this signature in database
GPG Key ID: EE9CCB427DFEC897

@ -139,10 +139,6 @@ func (f GenericFlag) ApplyWithError(set *flag.FlagSet) error {
return nil
}
func (f GenericFlag) IsRequired() bool {
return f.Required
}
// StringSlice is an opaque type for []string to satisfy flag.Value and flag.Getter
type StringSlice []string
@ -200,10 +196,6 @@ func (f StringSliceFlag) ApplyWithError(set *flag.FlagSet) error {
return nil
}
func (f StringSliceFlag) IsRequired() bool {
return f.Required
}
// IntSlice is an opaque type for []int to satisfy flag.Value and flag.Getter
type IntSlice []int
@ -283,10 +275,6 @@ func (f *Int64Slice) String() string {
return fmt.Sprintf("%#v", *f)
}
func (f IntSliceFlag) IsRequired() bool {
return f.Required
}
// Value returns the slice of ints set by this flag
func (f *Int64Slice) Value() []int64 {
return *f
@ -335,10 +323,6 @@ func (f BoolFlag) Apply(set *flag.FlagSet) {
f.ApplyWithError(set)
}
func (f BoolFlag) IsRequired() bool {
return f.Required
}
// ApplyWithError populates the flag given the flag set and environment
func (f BoolFlag) ApplyWithError(set *flag.FlagSet) error {
val := false
@ -398,10 +382,6 @@ func (f BoolTFlag) ApplyWithError(set *flag.FlagSet) error {
return nil
}
func (f BoolTFlag) IsRequired() bool {
return f.Required
}
// Apply populates the flag given the flag set and environment
// Ignores errors
func (f StringFlag) Apply(set *flag.FlagSet) {
@ -458,10 +438,6 @@ func (f Int64Flag) Apply(set *flag.FlagSet) {
f.ApplyWithError(set)
}
func (f StringFlag) IsRequired() bool {
return f.Required
}
// ApplyWithError populates the flag given the flag set and environment
func (f Int64Flag) ApplyWithError(set *flag.FlagSet) error {
if envVal, ok := flagFromFileEnv(f.FilePath, f.EnvVar); ok {
@ -512,10 +488,6 @@ func (f UintFlag) ApplyWithError(set *flag.FlagSet) error {
return nil
}
func (f IntFlag) IsRequired() bool {
return f.Required
}
// Apply populates the flag given the flag set and environment
// Ignores errors
func (f Uint64Flag) Apply(set *flag.FlagSet) {
@ -572,10 +544,6 @@ func (f DurationFlag) ApplyWithError(set *flag.FlagSet) error {
return nil
}
func (f DurationFlag) IsRequired() bool {
return f.Required
}
// Apply populates the flag given the flag set and environment
// Ignores errors
func (f Float64Flag) Apply(set *flag.FlagSet) {
@ -615,10 +583,6 @@ func visibleFlags(fl []Flag) []Flag {
return visible
}
func (f Float64Flag) IsRequired() bool {
return f.Required
}
func prefixFor(name string) (prefix string) {
if len(name) == 1 {
prefix = "-"

Loading…
Cancel
Save