Skip to content

Commit 60d4c37

Browse files
committed
Merge pull request ogier#10 from eparis/declare_by_name
Declare Flag{ by name instead of order
2 parents 5a5d661 + db78b3f commit 60d4c37

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

flag.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,13 @@ func (f *FlagSet) Var(value Value, name string, usage string) {
379379
// Like Var, but accepts a shorthand letter that can be used after a single dash.
380380
func (f *FlagSet) VarP(value Value, name, shorthand, usage string) {
381381
// Remember the default value as a string; it won't change.
382-
flag := &Flag{name, shorthand, usage, value, value.String(), false, make(map[string][]string)}
382+
flag := &Flag{
383+
Name: name,
384+
Shorthand: shorthand,
385+
Usage: usage,
386+
Value: value,
387+
DefValue: value.String(),
388+
}
383389
f.AddFlag(flag)
384390
}
385391

0 commit comments

Comments
 (0)