Revert "--help option and help command should print to stdout not stderr"

This reverts commit 61b129d81802e3c988cc0e67e488b24968dd748a.

Signed-off-by: Victor Vieux <vieux@docker.com>
This commit is contained in:
Victor Vieux 2014-08-27 18:59:13 +00:00
parent 7b9f693120
commit 590f57752e

View file

@ -395,19 +395,6 @@ func Lookup(name string) *Flag {
return CommandLine.formal[name] return CommandLine.formal[name]
} }
func (f *FlagSet) BadArgs(nargs int) bool {
if NArg() < nargs {
fmt.Fprintf(f.out(), "docker: '%s' requires arguments. See 'docker %s --help'.\n", f.name, f.name)
return true
} else {
if nargs == 0 && NArg() != 0 {
fmt.Fprintf(f.out(), "docker: '%s' does not require arguments. See 'docker %s --help'.\n", f.name, f.name)
return true
}
}
return false
}
// Set sets the value of the named flag. // Set sets the value of the named flag.
func (f *FlagSet) Set(name, value string) error { func (f *FlagSet) Set(name, value string) error {
flag, ok := f.formal[name] flag, ok := f.formal[name]
@ -481,7 +468,7 @@ func defaultUsage(f *FlagSet) {
// Usage prints to standard error a usage message documenting all defined command-line flags. // Usage prints to standard error a usage message documenting all defined command-line flags.
// The function is a variable that may be changed to point to a custom function. // The function is a variable that may be changed to point to a custom function.
var Usage = func() { var Usage = func() {
fmt.Fprintf(CommandLine.output, "Usage of %s:\n", os.Args[0]) fmt.Fprintf(os.Stderr, "Usage of %s:\n", os.Args[0])
PrintDefaults() PrintDefaults()
} }
@ -770,7 +757,7 @@ func Var(value Value, names []string, usage string) {
func (f *FlagSet) failf(format string, a ...interface{}) error { func (f *FlagSet) failf(format string, a ...interface{}) error {
err := fmt.Errorf(format, a...) err := fmt.Errorf(format, a...)
fmt.Fprintln(f.out(), err) fmt.Fprintln(f.out(), err)
fmt.Fprintf(f.out(), "See 'docker %s --help'.\n", f.name) f.usage()
return err return err
} }