Merge pull request #10 from eparis/declare_by_name
Declare Flag{ by name instead of orderdiff --git a/flag.go b/flag.go
index 7fb0990..33db47c 100644
--- a/flag.go
+++ b/flag.go
@@ -379,7 +379,13 @@
// Like Var, but accepts a shorthand letter that can be used after a single dash.
func (f *FlagSet) VarP(value Value, name, shorthand, usage string) {
// Remember the default value as a string; it won't change.
- flag := &Flag{name, shorthand, usage, value, value.String(), false, make(map[string][]string)}
+ flag := &Flag{
+ Name: name,
+ Shorthand: shorthand,
+ Usage: usage,
+ Value: value,
+ DefValue: value.String(),
+ }
f.AddFlag(flag)
}