Handle bad options better
* Do not log bad options error message twice, e.g.: $ docker run --pouet flag provided but not defined: --pouet See 'docker run --help'. 2014/11/05 21:41:23 flag provided but not defined: --pouet With this patch just the first two lines will be produced. * Print 'docker' just once when run without a command, e.g.: $ docker --hel flag provided but not defined: --hel See 'docker docker --help'. Signed-off-by: Michal Minar <miminar@redhat.com>
This commit is contained in:
parent
f23192465b
commit
cfb25ffb10
1 changed files with 5 additions and 1 deletions
|
@ -852,7 +852,11 @@ func Var(value Value, names []string, usage string) {
|
|||
func (f *FlagSet) failf(format string, a ...interface{}) error {
|
||||
err := fmt.Errorf(format, a...)
|
||||
fmt.Fprintln(f.Out(), err)
|
||||
fmt.Fprintf(f.Out(), "See 'docker %s --help'.\n", f.name)
|
||||
if os.Args[0] == f.name {
|
||||
fmt.Fprintf(f.Out(), "See '%s --help'.\n", os.Args[0])
|
||||
} else {
|
||||
fmt.Fprintf(f.Out(), "See '%s %s --help'.\n", os.Args[0], f.name)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue