removed extranneous value method on the generic type
This commit is contained in:
parent
13e88629f5
commit
1eaa882c3a
@ -197,7 +197,7 @@ func lookupIntSlice(name string, set *flag.FlagSet) []int {
|
|||||||
func lookupGeneric(name string, set *flag.FlagSet) interface{} {
|
func lookupGeneric(name string, set *flag.FlagSet) interface{} {
|
||||||
f := set.Lookup(name)
|
f := set.Lookup(name)
|
||||||
if f != nil {
|
if f != nil {
|
||||||
return (f.Value.(Generic)).Value()
|
return f.Value
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
1
flag.go
1
flag.go
@ -41,7 +41,6 @@ func eachName(longName string, fn func(string)) {
|
|||||||
type Generic interface {
|
type Generic interface {
|
||||||
Set(value string) error
|
Set(value string) error
|
||||||
String() string
|
String() string
|
||||||
Value() interface{}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// GenericFlag is the flag type for types implementing Generic
|
// GenericFlag is the flag type for types implementing Generic
|
||||||
|
@ -176,10 +176,6 @@ func (p *Parser) String() string {
|
|||||||
return fmt.Sprintf("%s,%s", p[0], p[1])
|
return fmt.Sprintf("%s,%s", p[0], p[1])
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *Parser) Value() interface{} {
|
|
||||||
return p
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestParseGeneric(t *testing.T) {
|
func TestParseGeneric(t *testing.T) {
|
||||||
a := cli.App{
|
a := cli.App{
|
||||||
Flags: []cli.Flag{
|
Flags: []cli.Flag{
|
||||||
|
Loading…
Reference in New Issue
Block a user