mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
update godep for github.com/spf13/pflag
This commit is contained in:
parent
ddc884f8e4
commit
6140ab26d0
2
Godeps/Godeps.json
generated
2
Godeps/Godeps.json
generated
@ -2158,7 +2158,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "github.com/spf13/pflag",
|
"ImportPath": "github.com/spf13/pflag",
|
||||||
"Rev": "1560c1005499d61b80f865c04d39ca7505bf7f0b"
|
"Rev": "c7e63cf4530bcd3ba943729cee0efeff2ebea63f"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "github.com/spf13/viper",
|
"ImportPath": "github.com/spf13/viper",
|
||||||
|
4
vendor/github.com/spf13/pflag/.travis.yml
generated
vendored
4
vendor/github.com/spf13/pflag/.travis.yml
generated
vendored
@ -5,8 +5,12 @@ language: go
|
|||||||
go:
|
go:
|
||||||
- 1.5.4
|
- 1.5.4
|
||||||
- 1.6.3
|
- 1.6.3
|
||||||
|
- 1.7
|
||||||
- tip
|
- tip
|
||||||
|
|
||||||
|
matrix:
|
||||||
|
allow_failures:
|
||||||
|
- go: tip
|
||||||
install:
|
install:
|
||||||
- go get github.com/golang/lint/golint
|
- go get github.com/golang/lint/golint
|
||||||
- export PATH=$GOPATH/bin:$PATH
|
- export PATH=$GOPATH/bin:$PATH
|
||||||
|
7
vendor/github.com/spf13/pflag/bool.go
generated
vendored
7
vendor/github.com/spf13/pflag/bool.go
generated
vendored
@ -1,9 +1,6 @@
|
|||||||
package pflag
|
package pflag
|
||||||
|
|
||||||
import (
|
import "strconv"
|
||||||
"fmt"
|
|
||||||
"strconv"
|
|
||||||
)
|
|
||||||
|
|
||||||
// optional interface to indicate boolean flags that can be
|
// optional interface to indicate boolean flags that can be
|
||||||
// supplied without "=value" text
|
// supplied without "=value" text
|
||||||
@ -30,7 +27,7 @@ func (b *boolValue) Type() string {
|
|||||||
return "bool"
|
return "bool"
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *boolValue) String() string { return fmt.Sprintf("%v", *b) }
|
func (b *boolValue) String() string { return strconv.FormatBool(bool(*b)) }
|
||||||
|
|
||||||
func (b *boolValue) IsBoolFlag() bool { return true }
|
func (b *boolValue) IsBoolFlag() bool { return true }
|
||||||
|
|
||||||
|
7
vendor/github.com/spf13/pflag/count.go
generated
vendored
7
vendor/github.com/spf13/pflag/count.go
generated
vendored
@ -1,9 +1,6 @@
|
|||||||
package pflag
|
package pflag
|
||||||
|
|
||||||
import (
|
import "strconv"
|
||||||
"fmt"
|
|
||||||
"strconv"
|
|
||||||
)
|
|
||||||
|
|
||||||
// -- count Value
|
// -- count Value
|
||||||
type countValue int
|
type countValue int
|
||||||
@ -28,7 +25,7 @@ func (i *countValue) Type() string {
|
|||||||
return "count"
|
return "count"
|
||||||
}
|
}
|
||||||
|
|
||||||
func (i *countValue) String() string { return fmt.Sprintf("%v", *i) }
|
func (i *countValue) String() string { return strconv.Itoa(int(*i)) }
|
||||||
|
|
||||||
func countConv(sval string) (interface{}, error) {
|
func countConv(sval string) (interface{}, error) {
|
||||||
i, err := strconv.Atoi(sval)
|
i, err := strconv.Atoi(sval)
|
||||||
|
45
vendor/github.com/spf13/pflag/flag.go
generated
vendored
45
vendor/github.com/spf13/pflag/flag.go
generated
vendored
@ -419,10 +419,25 @@ func (f *FlagSet) PrintDefaults() {
|
|||||||
fmt.Fprintf(f.out(), "%s", usages)
|
fmt.Fprintf(f.out(), "%s", usages)
|
||||||
}
|
}
|
||||||
|
|
||||||
// isZeroValue guesses whether the string represents the zero
|
// defaultIsZeroValue returns true if the default value for this flag represents
|
||||||
// value for a flag. It is not accurate but in practice works OK.
|
// a zero value.
|
||||||
func isZeroValue(value string) bool {
|
func (f *Flag) defaultIsZeroValue() bool {
|
||||||
switch value {
|
switch f.Value.(type) {
|
||||||
|
case boolFlag:
|
||||||
|
return f.DefValue == "false"
|
||||||
|
case *durationValue:
|
||||||
|
// Beginning in Go 1.7, duration zero values are "0s"
|
||||||
|
return f.DefValue == "0" || f.DefValue == "0s"
|
||||||
|
case *intValue, *int8Value, *int32Value, *int64Value, *uintValue, *uint8Value, *uint16Value, *uint32Value, *uint64Value, *countValue, *float32Value, *float64Value:
|
||||||
|
return f.DefValue == "0"
|
||||||
|
case *stringValue:
|
||||||
|
return f.DefValue == ""
|
||||||
|
case *ipValue, *ipMaskValue, *ipNetValue:
|
||||||
|
return f.DefValue == "<nil>"
|
||||||
|
case *intSliceValue, *stringSliceValue, *stringArrayValue:
|
||||||
|
return f.DefValue == "[]"
|
||||||
|
default:
|
||||||
|
switch f.Value.String() {
|
||||||
case "false":
|
case "false":
|
||||||
return true
|
return true
|
||||||
case "<nil>":
|
case "<nil>":
|
||||||
@ -434,6 +449,7 @@ func isZeroValue(value string) bool {
|
|||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// UnquoteUsage extracts a back-quoted name from the usage
|
// UnquoteUsage extracts a back-quoted name from the usage
|
||||||
// string for a flag and returns it and the un-quoted usage.
|
// string for a flag and returns it and the un-quoted usage.
|
||||||
@ -455,22 +471,19 @@ func UnquoteUsage(flag *Flag) (name string, usage string) {
|
|||||||
break // Only one back quote; use type name.
|
break // Only one back quote; use type name.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// No explicit name, so use type if we can find one.
|
|
||||||
name = "value"
|
name = flag.Value.Type()
|
||||||
switch flag.Value.(type) {
|
switch name {
|
||||||
case boolFlag:
|
case "bool":
|
||||||
name = ""
|
name = ""
|
||||||
case *durationValue:
|
case "float64":
|
||||||
name = "duration"
|
|
||||||
case *float64Value:
|
|
||||||
name = "float"
|
name = "float"
|
||||||
case *intValue, *int64Value:
|
case "int64":
|
||||||
name = "int"
|
name = "int"
|
||||||
case *stringValue:
|
case "uint64":
|
||||||
name = "string"
|
|
||||||
case *uintValue, *uint64Value:
|
|
||||||
name = "uint"
|
name = "uint"
|
||||||
}
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -519,7 +532,7 @@ func (f *FlagSet) FlagUsages() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
line += usage
|
line += usage
|
||||||
if !isZeroValue(flag.DefValue) {
|
if !flag.defaultIsZeroValue() {
|
||||||
if flag.Value.Type() == "string" {
|
if flag.Value.Type() == "string" {
|
||||||
line += fmt.Sprintf(" (default %q)", flag.DefValue)
|
line += fmt.Sprintf(" (default %q)", flag.DefValue)
|
||||||
} else {
|
} else {
|
||||||
|
7
vendor/github.com/spf13/pflag/float32.go
generated
vendored
7
vendor/github.com/spf13/pflag/float32.go
generated
vendored
@ -1,9 +1,6 @@
|
|||||||
package pflag
|
package pflag
|
||||||
|
|
||||||
import (
|
import "strconv"
|
||||||
"fmt"
|
|
||||||
"strconv"
|
|
||||||
)
|
|
||||||
|
|
||||||
// -- float32 Value
|
// -- float32 Value
|
||||||
type float32Value float32
|
type float32Value float32
|
||||||
@ -23,7 +20,7 @@ func (f *float32Value) Type() string {
|
|||||||
return "float32"
|
return "float32"
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *float32Value) String() string { return fmt.Sprintf("%v", *f) }
|
func (f *float32Value) String() string { return strconv.FormatFloat(float64(*f), 'g', -1, 32) }
|
||||||
|
|
||||||
func float32Conv(sval string) (interface{}, error) {
|
func float32Conv(sval string) (interface{}, error) {
|
||||||
v, err := strconv.ParseFloat(sval, 32)
|
v, err := strconv.ParseFloat(sval, 32)
|
||||||
|
7
vendor/github.com/spf13/pflag/float64.go
generated
vendored
7
vendor/github.com/spf13/pflag/float64.go
generated
vendored
@ -1,9 +1,6 @@
|
|||||||
package pflag
|
package pflag
|
||||||
|
|
||||||
import (
|
import "strconv"
|
||||||
"fmt"
|
|
||||||
"strconv"
|
|
||||||
)
|
|
||||||
|
|
||||||
// -- float64 Value
|
// -- float64 Value
|
||||||
type float64Value float64
|
type float64Value float64
|
||||||
@ -23,7 +20,7 @@ func (f *float64Value) Type() string {
|
|||||||
return "float64"
|
return "float64"
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *float64Value) String() string { return fmt.Sprintf("%v", *f) }
|
func (f *float64Value) String() string { return strconv.FormatFloat(float64(*f), 'g', -1, 64) }
|
||||||
|
|
||||||
func float64Conv(sval string) (interface{}, error) {
|
func float64Conv(sval string) (interface{}, error) {
|
||||||
return strconv.ParseFloat(sval, 64)
|
return strconv.ParseFloat(sval, 64)
|
||||||
|
7
vendor/github.com/spf13/pflag/int.go
generated
vendored
7
vendor/github.com/spf13/pflag/int.go
generated
vendored
@ -1,9 +1,6 @@
|
|||||||
package pflag
|
package pflag
|
||||||
|
|
||||||
import (
|
import "strconv"
|
||||||
"fmt"
|
|
||||||
"strconv"
|
|
||||||
)
|
|
||||||
|
|
||||||
// -- int Value
|
// -- int Value
|
||||||
type intValue int
|
type intValue int
|
||||||
@ -23,7 +20,7 @@ func (i *intValue) Type() string {
|
|||||||
return "int"
|
return "int"
|
||||||
}
|
}
|
||||||
|
|
||||||
func (i *intValue) String() string { return fmt.Sprintf("%v", *i) }
|
func (i *intValue) String() string { return strconv.Itoa(int(*i)) }
|
||||||
|
|
||||||
func intConv(sval string) (interface{}, error) {
|
func intConv(sval string) (interface{}, error) {
|
||||||
return strconv.Atoi(sval)
|
return strconv.Atoi(sval)
|
||||||
|
7
vendor/github.com/spf13/pflag/int32.go
generated
vendored
7
vendor/github.com/spf13/pflag/int32.go
generated
vendored
@ -1,9 +1,6 @@
|
|||||||
package pflag
|
package pflag
|
||||||
|
|
||||||
import (
|
import "strconv"
|
||||||
"fmt"
|
|
||||||
"strconv"
|
|
||||||
)
|
|
||||||
|
|
||||||
// -- int32 Value
|
// -- int32 Value
|
||||||
type int32Value int32
|
type int32Value int32
|
||||||
@ -23,7 +20,7 @@ func (i *int32Value) Type() string {
|
|||||||
return "int32"
|
return "int32"
|
||||||
}
|
}
|
||||||
|
|
||||||
func (i *int32Value) String() string { return fmt.Sprintf("%v", *i) }
|
func (i *int32Value) String() string { return strconv.FormatInt(int64(*i), 10) }
|
||||||
|
|
||||||
func int32Conv(sval string) (interface{}, error) {
|
func int32Conv(sval string) (interface{}, error) {
|
||||||
v, err := strconv.ParseInt(sval, 0, 32)
|
v, err := strconv.ParseInt(sval, 0, 32)
|
||||||
|
7
vendor/github.com/spf13/pflag/int64.go
generated
vendored
7
vendor/github.com/spf13/pflag/int64.go
generated
vendored
@ -1,9 +1,6 @@
|
|||||||
package pflag
|
package pflag
|
||||||
|
|
||||||
import (
|
import "strconv"
|
||||||
"fmt"
|
|
||||||
"strconv"
|
|
||||||
)
|
|
||||||
|
|
||||||
// -- int64 Value
|
// -- int64 Value
|
||||||
type int64Value int64
|
type int64Value int64
|
||||||
@ -23,7 +20,7 @@ func (i *int64Value) Type() string {
|
|||||||
return "int64"
|
return "int64"
|
||||||
}
|
}
|
||||||
|
|
||||||
func (i *int64Value) String() string { return fmt.Sprintf("%v", *i) }
|
func (i *int64Value) String() string { return strconv.FormatInt(int64(*i), 10) }
|
||||||
|
|
||||||
func int64Conv(sval string) (interface{}, error) {
|
func int64Conv(sval string) (interface{}, error) {
|
||||||
return strconv.ParseInt(sval, 0, 64)
|
return strconv.ParseInt(sval, 0, 64)
|
||||||
|
7
vendor/github.com/spf13/pflag/int8.go
generated
vendored
7
vendor/github.com/spf13/pflag/int8.go
generated
vendored
@ -1,9 +1,6 @@
|
|||||||
package pflag
|
package pflag
|
||||||
|
|
||||||
import (
|
import "strconv"
|
||||||
"fmt"
|
|
||||||
"strconv"
|
|
||||||
)
|
|
||||||
|
|
||||||
// -- int8 Value
|
// -- int8 Value
|
||||||
type int8Value int8
|
type int8Value int8
|
||||||
@ -23,7 +20,7 @@ func (i *int8Value) Type() string {
|
|||||||
return "int8"
|
return "int8"
|
||||||
}
|
}
|
||||||
|
|
||||||
func (i *int8Value) String() string { return fmt.Sprintf("%v", *i) }
|
func (i *int8Value) String() string { return strconv.FormatInt(int64(*i), 10) }
|
||||||
|
|
||||||
func int8Conv(sval string) (interface{}, error) {
|
func int8Conv(sval string) (interface{}, error) {
|
||||||
v, err := strconv.ParseInt(sval, 0, 8)
|
v, err := strconv.ParseInt(sval, 0, 8)
|
||||||
|
4
vendor/github.com/spf13/pflag/string.go
generated
vendored
4
vendor/github.com/spf13/pflag/string.go
generated
vendored
@ -1,7 +1,5 @@
|
|||||||
package pflag
|
package pflag
|
||||||
|
|
||||||
import "fmt"
|
|
||||||
|
|
||||||
// -- string Value
|
// -- string Value
|
||||||
type stringValue string
|
type stringValue string
|
||||||
|
|
||||||
@ -18,7 +16,7 @@ func (s *stringValue) Type() string {
|
|||||||
return "string"
|
return "string"
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *stringValue) String() string { return fmt.Sprintf("%s", *s) }
|
func (s *stringValue) String() string { return string(*s) }
|
||||||
|
|
||||||
func stringConv(sval string) (interface{}, error) {
|
func stringConv(sval string) (interface{}, error) {
|
||||||
return sval, nil
|
return sval, nil
|
||||||
|
110
vendor/github.com/spf13/pflag/string_array.go
generated
vendored
Normal file
110
vendor/github.com/spf13/pflag/string_array.go
generated
vendored
Normal file
@ -0,0 +1,110 @@
|
|||||||
|
package pflag
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
|
var _ = fmt.Fprint
|
||||||
|
|
||||||
|
// -- stringArray Value
|
||||||
|
type stringArrayValue struct {
|
||||||
|
value *[]string
|
||||||
|
changed bool
|
||||||
|
}
|
||||||
|
|
||||||
|
func newStringArrayValue(val []string, p *[]string) *stringArrayValue {
|
||||||
|
ssv := new(stringArrayValue)
|
||||||
|
ssv.value = p
|
||||||
|
*ssv.value = val
|
||||||
|
return ssv
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *stringArrayValue) Set(val string) error {
|
||||||
|
if !s.changed {
|
||||||
|
*s.value = []string{val}
|
||||||
|
s.changed = true
|
||||||
|
} else {
|
||||||
|
*s.value = append(*s.value, val)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *stringArrayValue) Type() string {
|
||||||
|
return "stringArray"
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *stringArrayValue) String() string {
|
||||||
|
str, _ := writeAsCSV(*s.value)
|
||||||
|
return "[" + str + "]"
|
||||||
|
}
|
||||||
|
|
||||||
|
func stringArrayConv(sval string) (interface{}, error) {
|
||||||
|
sval = strings.Trim(sval, "[]")
|
||||||
|
// An empty string would cause a array with one (empty) string
|
||||||
|
if len(sval) == 0 {
|
||||||
|
return []string{}, nil
|
||||||
|
}
|
||||||
|
return readAsCSV(sval)
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetStringArray return the []string value of a flag with the given name
|
||||||
|
func (f *FlagSet) GetStringArray(name string) ([]string, error) {
|
||||||
|
val, err := f.getFlagType(name, "stringArray", stringArrayConv)
|
||||||
|
if err != nil {
|
||||||
|
return []string{}, err
|
||||||
|
}
|
||||||
|
return val.([]string), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// StringArrayVar defines a string flag with specified name, default value, and usage string.
|
||||||
|
// The argument p points to a []string variable in which to store the values of the multiple flags.
|
||||||
|
// The value of each argument will not try to be separated by comma
|
||||||
|
func (f *FlagSet) StringArrayVar(p *[]string, name string, value []string, usage string) {
|
||||||
|
f.VarP(newStringArrayValue(value, p), name, "", usage)
|
||||||
|
}
|
||||||
|
|
||||||
|
// StringArrayVarP is like StringArrayVar, but accepts a shorthand letter that can be used after a single dash.
|
||||||
|
func (f *FlagSet) StringArrayVarP(p *[]string, name, shorthand string, value []string, usage string) {
|
||||||
|
f.VarP(newStringArrayValue(value, p), name, shorthand, usage)
|
||||||
|
}
|
||||||
|
|
||||||
|
// StringArrayVar defines a string flag with specified name, default value, and usage string.
|
||||||
|
// The argument p points to a []string variable in which to store the value of the flag.
|
||||||
|
// The value of each argument will not try to be separated by comma
|
||||||
|
func StringArrayVar(p *[]string, name string, value []string, usage string) {
|
||||||
|
CommandLine.VarP(newStringArrayValue(value, p), name, "", usage)
|
||||||
|
}
|
||||||
|
|
||||||
|
// StringArrayVarP is like StringArrayVar, but accepts a shorthand letter that can be used after a single dash.
|
||||||
|
func StringArrayVarP(p *[]string, name, shorthand string, value []string, usage string) {
|
||||||
|
CommandLine.VarP(newStringArrayValue(value, p), name, shorthand, usage)
|
||||||
|
}
|
||||||
|
|
||||||
|
// StringArray defines a string flag with specified name, default value, and usage string.
|
||||||
|
// The return value is the address of a []string variable that stores the value of the flag.
|
||||||
|
// The value of each argument will not try to be separated by comma
|
||||||
|
func (f *FlagSet) StringArray(name string, value []string, usage string) *[]string {
|
||||||
|
p := []string{}
|
||||||
|
f.StringArrayVarP(&p, name, "", value, usage)
|
||||||
|
return &p
|
||||||
|
}
|
||||||
|
|
||||||
|
// StringArrayP is like StringArray, but accepts a shorthand letter that can be used after a single dash.
|
||||||
|
func (f *FlagSet) StringArrayP(name, shorthand string, value []string, usage string) *[]string {
|
||||||
|
p := []string{}
|
||||||
|
f.StringArrayVarP(&p, name, shorthand, value, usage)
|
||||||
|
return &p
|
||||||
|
}
|
||||||
|
|
||||||
|
// StringArray defines a string flag with specified name, default value, and usage string.
|
||||||
|
// The return value is the address of a []string variable that stores the value of the flag.
|
||||||
|
// The value of each argument will not try to be separated by comma
|
||||||
|
func StringArray(name string, value []string, usage string) *[]string {
|
||||||
|
return CommandLine.StringArrayP(name, "", value, usage)
|
||||||
|
}
|
||||||
|
|
||||||
|
// StringArrayP is like StringArray, but accepts a shorthand letter that can be used after a single dash.
|
||||||
|
func StringArrayP(name, shorthand string, value []string, usage string) *[]string {
|
||||||
|
return CommandLine.StringArrayP(name, shorthand, value, usage)
|
||||||
|
}
|
31
vendor/github.com/spf13/pflag/string_slice.go
generated
vendored
31
vendor/github.com/spf13/pflag/string_slice.go
generated
vendored
@ -1,6 +1,7 @@
|
|||||||
package pflag
|
package pflag
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bytes"
|
||||||
"encoding/csv"
|
"encoding/csv"
|
||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
@ -21,10 +22,28 @@ func newStringSliceValue(val []string, p *[]string) *stringSliceValue {
|
|||||||
return ssv
|
return ssv
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *stringSliceValue) Set(val string) error {
|
func readAsCSV(val string) ([]string, error) {
|
||||||
|
if val == "" {
|
||||||
|
return []string{}, nil
|
||||||
|
}
|
||||||
stringReader := strings.NewReader(val)
|
stringReader := strings.NewReader(val)
|
||||||
csvReader := csv.NewReader(stringReader)
|
csvReader := csv.NewReader(stringReader)
|
||||||
v, err := csvReader.Read()
|
return csvReader.Read()
|
||||||
|
}
|
||||||
|
|
||||||
|
func writeAsCSV(vals []string) (string, error) {
|
||||||
|
b := &bytes.Buffer{}
|
||||||
|
w := csv.NewWriter(b)
|
||||||
|
err := w.Write(vals)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
w.Flush()
|
||||||
|
return strings.TrimSuffix(b.String(), fmt.Sprintln()), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *stringSliceValue) Set(val string) error {
|
||||||
|
v, err := readAsCSV(val)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -41,7 +60,10 @@ func (s *stringSliceValue) Type() string {
|
|||||||
return "stringSlice"
|
return "stringSlice"
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *stringSliceValue) String() string { return "[" + strings.Join(*s.value, ",") + "]" }
|
func (s *stringSliceValue) String() string {
|
||||||
|
str, _ := writeAsCSV(*s.value)
|
||||||
|
return "[" + str + "]"
|
||||||
|
}
|
||||||
|
|
||||||
func stringSliceConv(sval string) (interface{}, error) {
|
func stringSliceConv(sval string) (interface{}, error) {
|
||||||
sval = strings.Trim(sval, "[]")
|
sval = strings.Trim(sval, "[]")
|
||||||
@ -49,8 +71,7 @@ func stringSliceConv(sval string) (interface{}, error) {
|
|||||||
if len(sval) == 0 {
|
if len(sval) == 0 {
|
||||||
return []string{}, nil
|
return []string{}, nil
|
||||||
}
|
}
|
||||||
v := strings.Split(sval, ",")
|
return readAsCSV(sval)
|
||||||
return v, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetStringSlice return the []string value of a flag with the given name
|
// GetStringSlice return the []string value of a flag with the given name
|
||||||
|
7
vendor/github.com/spf13/pflag/uint.go
generated
vendored
7
vendor/github.com/spf13/pflag/uint.go
generated
vendored
@ -1,9 +1,6 @@
|
|||||||
package pflag
|
package pflag
|
||||||
|
|
||||||
import (
|
import "strconv"
|
||||||
"fmt"
|
|
||||||
"strconv"
|
|
||||||
)
|
|
||||||
|
|
||||||
// -- uint Value
|
// -- uint Value
|
||||||
type uintValue uint
|
type uintValue uint
|
||||||
@ -23,7 +20,7 @@ func (i *uintValue) Type() string {
|
|||||||
return "uint"
|
return "uint"
|
||||||
}
|
}
|
||||||
|
|
||||||
func (i *uintValue) String() string { return fmt.Sprintf("%v", *i) }
|
func (i *uintValue) String() string { return strconv.FormatUint(uint64(*i), 10) }
|
||||||
|
|
||||||
func uintConv(sval string) (interface{}, error) {
|
func uintConv(sval string) (interface{}, error) {
|
||||||
v, err := strconv.ParseUint(sval, 0, 0)
|
v, err := strconv.ParseUint(sval, 0, 0)
|
||||||
|
9
vendor/github.com/spf13/pflag/uint16.go
generated
vendored
9
vendor/github.com/spf13/pflag/uint16.go
generated
vendored
@ -1,9 +1,6 @@
|
|||||||
package pflag
|
package pflag
|
||||||
|
|
||||||
import (
|
import "strconv"
|
||||||
"fmt"
|
|
||||||
"strconv"
|
|
||||||
)
|
|
||||||
|
|
||||||
// -- uint16 value
|
// -- uint16 value
|
||||||
type uint16Value uint16
|
type uint16Value uint16
|
||||||
@ -12,7 +9,7 @@ func newUint16Value(val uint16, p *uint16) *uint16Value {
|
|||||||
*p = val
|
*p = val
|
||||||
return (*uint16Value)(p)
|
return (*uint16Value)(p)
|
||||||
}
|
}
|
||||||
func (i *uint16Value) String() string { return fmt.Sprintf("%d", *i) }
|
|
||||||
func (i *uint16Value) Set(s string) error {
|
func (i *uint16Value) Set(s string) error {
|
||||||
v, err := strconv.ParseUint(s, 0, 16)
|
v, err := strconv.ParseUint(s, 0, 16)
|
||||||
*i = uint16Value(v)
|
*i = uint16Value(v)
|
||||||
@ -23,6 +20,8 @@ func (i *uint16Value) Type() string {
|
|||||||
return "uint16"
|
return "uint16"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (i *uint16Value) String() string { return strconv.FormatUint(uint64(*i), 10) }
|
||||||
|
|
||||||
func uint16Conv(sval string) (interface{}, error) {
|
func uint16Conv(sval string) (interface{}, error) {
|
||||||
v, err := strconv.ParseUint(sval, 0, 16)
|
v, err := strconv.ParseUint(sval, 0, 16)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
11
vendor/github.com/spf13/pflag/uint32.go
generated
vendored
11
vendor/github.com/spf13/pflag/uint32.go
generated
vendored
@ -1,18 +1,15 @@
|
|||||||
package pflag
|
package pflag
|
||||||
|
|
||||||
import (
|
import "strconv"
|
||||||
"fmt"
|
|
||||||
"strconv"
|
|
||||||
)
|
|
||||||
|
|
||||||
// -- uint16 value
|
// -- uint32 value
|
||||||
type uint32Value uint32
|
type uint32Value uint32
|
||||||
|
|
||||||
func newUint32Value(val uint32, p *uint32) *uint32Value {
|
func newUint32Value(val uint32, p *uint32) *uint32Value {
|
||||||
*p = val
|
*p = val
|
||||||
return (*uint32Value)(p)
|
return (*uint32Value)(p)
|
||||||
}
|
}
|
||||||
func (i *uint32Value) String() string { return fmt.Sprintf("%d", *i) }
|
|
||||||
func (i *uint32Value) Set(s string) error {
|
func (i *uint32Value) Set(s string) error {
|
||||||
v, err := strconv.ParseUint(s, 0, 32)
|
v, err := strconv.ParseUint(s, 0, 32)
|
||||||
*i = uint32Value(v)
|
*i = uint32Value(v)
|
||||||
@ -23,6 +20,8 @@ func (i *uint32Value) Type() string {
|
|||||||
return "uint32"
|
return "uint32"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (i *uint32Value) String() string { return strconv.FormatUint(uint64(*i), 10) }
|
||||||
|
|
||||||
func uint32Conv(sval string) (interface{}, error) {
|
func uint32Conv(sval string) (interface{}, error) {
|
||||||
v, err := strconv.ParseUint(sval, 0, 32)
|
v, err := strconv.ParseUint(sval, 0, 32)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
7
vendor/github.com/spf13/pflag/uint64.go
generated
vendored
7
vendor/github.com/spf13/pflag/uint64.go
generated
vendored
@ -1,9 +1,6 @@
|
|||||||
package pflag
|
package pflag
|
||||||
|
|
||||||
import (
|
import "strconv"
|
||||||
"fmt"
|
|
||||||
"strconv"
|
|
||||||
)
|
|
||||||
|
|
||||||
// -- uint64 Value
|
// -- uint64 Value
|
||||||
type uint64Value uint64
|
type uint64Value uint64
|
||||||
@ -23,7 +20,7 @@ func (i *uint64Value) Type() string {
|
|||||||
return "uint64"
|
return "uint64"
|
||||||
}
|
}
|
||||||
|
|
||||||
func (i *uint64Value) String() string { return fmt.Sprintf("%v", *i) }
|
func (i *uint64Value) String() string { return strconv.FormatUint(uint64(*i), 10) }
|
||||||
|
|
||||||
func uint64Conv(sval string) (interface{}, error) {
|
func uint64Conv(sval string) (interface{}, error) {
|
||||||
v, err := strconv.ParseUint(sval, 0, 64)
|
v, err := strconv.ParseUint(sval, 0, 64)
|
||||||
|
7
vendor/github.com/spf13/pflag/uint8.go
generated
vendored
7
vendor/github.com/spf13/pflag/uint8.go
generated
vendored
@ -1,9 +1,6 @@
|
|||||||
package pflag
|
package pflag
|
||||||
|
|
||||||
import (
|
import "strconv"
|
||||||
"fmt"
|
|
||||||
"strconv"
|
|
||||||
)
|
|
||||||
|
|
||||||
// -- uint8 Value
|
// -- uint8 Value
|
||||||
type uint8Value uint8
|
type uint8Value uint8
|
||||||
@ -23,7 +20,7 @@ func (i *uint8Value) Type() string {
|
|||||||
return "uint8"
|
return "uint8"
|
||||||
}
|
}
|
||||||
|
|
||||||
func (i *uint8Value) String() string { return fmt.Sprintf("%v", *i) }
|
func (i *uint8Value) String() string { return strconv.FormatUint(uint64(*i), 10) }
|
||||||
|
|
||||||
func uint8Conv(sval string) (interface{}, error) {
|
func uint8Conv(sval string) (interface{}, error) {
|
||||||
v, err := strconv.ParseUint(sval, 0, 8)
|
v, err := strconv.ParseUint(sval, 0, 8)
|
||||||
|
Loading…
Reference in New Issue
Block a user