diff --git a/CHANGELOG.md b/CHANGELOG.md index b6da886..205d8db 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/context_test.go b/context_test.go index 7625c5b..ae37637 100644 --- a/context_test.go +++ b/context_test.go @@ -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"} diff --git a/flag.go b/flag.go index abeff90..6af15ed 100644 --- a/flag.go +++ b/flag.go @@ -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