]> Cypherpunks repositories - gostls13.git/commit
flags: allow distinct sets of flags.
authorRob Pike <r@golang.org>
Sat, 21 May 2011 23:22:00 +0000 (09:22 +1000)
committerRob Pike <r@golang.org>
Sat, 21 May 2011 23:22:00 +0000 (09:22 +1000)
commitf4fe688b0983077cffe5baf8f4f62dfe196bffe9
tree54d21c133336762fc63498145c2515a8dcfcde14
parent648f25b237b47cc41ef64e9f8cee1c2afe894188
flags: allow distinct sets of flags.

A FlagSet is an independent set of flags that may be used,
for example, to provide flag processing for subcommands
in a CLI.  The standard, os.Args-derived set of flags is a
global but non-exported FlagSet and the standard functions
are wrappers for methods of that FlagSet.

Allow the programmer to control whether the program
exits if there is a parse error.  For the default set, the behavior
remains to exit on error.

The handling of Usage is odd due to backward compatibility.

R=golang-dev, bradfitz, r, bradfitz
CC=golang-dev
https://golang.org/cl/4517092
src/pkg/flag/export_test.go
src/pkg/flag/flag.go
src/pkg/flag/flag_test.go