From c5ba95ee26cbec9694a780544b559a797956ea54 Mon Sep 17 00:00:00 2001 From: Clayton Coleman Date: Thu, 11 Dec 2014 16:59:29 -0500 Subject: [PATCH] Add Type() method on flags for compat with pflag library Allows our flag objects to be used with both golang flags and pflags --- pkg/util/list.go | 4 ++++ pkg/util/net.go | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/pkg/util/list.go b/pkg/util/list.go index a64e0fcf34c..440a8bbba68 100644 --- a/pkg/util/list.go +++ b/pkg/util/list.go @@ -33,3 +33,7 @@ func (sl *StringList) Set(value string) error { } return nil } + +func (*StringList) Type() string { + return "stringList" +} diff --git a/pkg/util/net.go b/pkg/util/net.go index 53e3c64e366..f36b1cae3fd 100644 --- a/pkg/util/net.go +++ b/pkg/util/net.go @@ -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" +}