Commit Graph

4 Commits

Author SHA1 Message Date
Michal Minar 8a785792cd Exit with non-zero code on first argument parsing error
Ignoring return value of ParseFlags leads to exit code 0 if bad
arguments are supplied. This patch makes sure that subcommands exit
with non-zero code in such a case.

Signed-off-by: Michal Minar <miminar@redhat.com>
2015-01-06 13:46:38 +01:00
Michal Minar 08f0f1ee1d Fixed error reporting
Removed redundant print line and fixed handling of command-less docker
invocation.

Signed-off-by: Michal Minar <miminar@redhat.com>
2015-01-06 13:44:27 +01:00
Michal Minar 1d09fc22ca 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>
2015-01-06 13:44:27 +01:00
Tibor Vass 41be2f73c7 refactor redundant code around calls to cmd.Parse
Signed-off-by: Tibor Vass <teabee89@gmail.com>
2015-01-06 13:41:16 +01:00