Tweaks to Int64Flag PR

main
Dan Buch 8 years ago
parent 5c7cca7f16
commit 537f5beb66
No known key found for this signature in database
GPG Key ID: FAEF12936DD3E3EC

@ -7,6 +7,7 @@
- `./runtests` test runner with coverage tracking by default
- testing on OS X
- testing on Windows
- `Int64Flag` type and supporting code
### Changed
- Use spaces for alignment in help/usage output instead of tabs, making the

@ -13,7 +13,7 @@ func TestNewContext(t *testing.T) {
set.Float64("myflag64", float64(17), "doc")
globalSet := flag.NewFlagSet("test", 0)
globalSet.Int("myflag", 42, "doc")
globalSet.Int("myflagInt64", 42, "doc")
globalSet.Int64("myflagInt64", int64(42), "doc")
globalSet.Float64("myflag64", float64(47), "doc")
globalCtx := NewContext(nil, globalSet, nil)
command := Command{Name: "mycommand"}

@ -189,7 +189,7 @@ func (f *IntSlice) Set(value string) error {
// String returns a readable representation of this value (for usage defaults)
func (f *IntSlice) String() string {
return fmt.Sprintf("%d", *f)
return fmt.Sprintf("%#v", *f)
}
// Value returns the slice of ints set by this flag
@ -260,7 +260,7 @@ func (f *Int64Slice) Set(value string) error {
// String returns a readable representation of this value (for usage defaults)
func (f *Int64Slice) String() string {
return fmt.Sprintf("%d", *f)
return fmt.Sprintf("%#v", *f)
}
// Value returns the slice of ints set by this flag
@ -447,7 +447,6 @@ func (f StringFlag) GetName() string {
}
// IntFlag is a flag that takes an integer
// Errors if the value provided cannot be parsed
type IntFlag struct {
Name string
Value int
@ -492,7 +491,6 @@ func (f IntFlag) GetName() string {
}
// Int64Flag is a flag that takes a 64-bit integer
// Errors if the value provided cannot be parsed
type Int64Flag struct {
Name string
Value int64
@ -582,7 +580,6 @@ func (f DurationFlag) GetName() string {
}
// Float64Flag is a flag that takes an float value
// Errors if the value provided cannot be parsed
type Float64Flag struct {
Name string
Value float64

Loading…
Cancel
Save