diff options
author | Rob Pike <r@golang.org> | 2009-01-16 13:19:43 -0800 |
---|---|---|
committer | Rob Pike <r@golang.org> | 2009-01-16 13:19:43 -0800 |
commit | 38c559f4495816db8016c47ef93c600d81855c3d (patch) | |
tree | 80b5dbc1998b80b84d6826985e8659a85c53b89a /src/lib | |
parent | 2859dadce6efdb2ce882bbb9945c114742d1ea94 (diff) | |
download | golang-38c559f4495816db8016c47ef93c600d81855c3d.tar.gz |
casify flag.
R=rsc
DELTA=16 (0 added, 9 deleted, 7 changed)
OCL=22959
CL=22961
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/flag.go | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/src/lib/flag.go b/src/lib/flag.go index 9bed00db4..3274a854e 100644 --- a/src/lib/flag.go +++ b/src/lib/flag.go @@ -213,7 +213,7 @@ func (s *stringValue) str() string { } // -- Value interface -type Value interface { +type _Value interface { str() string; } @@ -221,25 +221,16 @@ type Value interface { export type Flag struct { name string; usage string; - value Value; + value _Value; } type allFlags struct { actual map[string] *Flag; formal map[string] *Flag; - first_arg int; + first_arg int; // 0 is the program name, 1 is first arg } - -func New() *allFlags { - f := new(allFlags); - f.first_arg = 1; // 0 is the program name, 1 is first arg - f.actual = make(map[string] *Flag); - f.formal = make(map[string] *Flag); - return f; -} - -var flags *allFlags = New(); +var flags *allFlags = &allFlags{make(map[string] *Flag), make(map[string] *Flag), 1} export func PrintDefaults() { for k, f := range flags.formal { @@ -273,7 +264,7 @@ export func NArg() int { return sys.argc() - flags.first_arg } -func add(name string, value Value, usage string) { +func add(name string, value _Value, usage string) { f := new(Flag); f.name = name; f.usage = usage; |