Add Type() method on flags for compat with pflag library

Allows our flag objects to be used with both golang flags and pflags
pull/6/head
Clayton Coleman 2014-12-11 16:59:29 -05:00
parent 244d55b0dd
commit c5ba95ee26
2 changed files with 12 additions and 0 deletions

View File

@ -33,3 +33,7 @@ func (sl *StringList) Set(value string) error {
}
return nil
}
func (*StringList) Type() string {
return "stringList"
}

View File

@ -37,6 +37,10 @@ func (ip *IP) Set(value string) error {
return nil
}
func (*IP) Type() string {
return "ip"
}
// IPNet adapts net.IPNet for use as a flag.
type IPNet net.IPNet
@ -53,3 +57,7 @@ func (ipnet *IPNet) Set(value string) error {
*ipnet = IPNet(*n)
return nil
}
func (*IPNet) Type() string {
return "ipNet"
}