Commit Graph

33 Commits

Author SHA1 Message Date
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
Dan Walsh 4dc962d09a Remove TestUsage, since Usage will no longer be shown on failure to parse
Docker-DCO-1.1-Signed-off-by: Dan Walsh <dwalsh@redhat.com> (github: rhatdan)
2015-01-06 13:40:14 +01:00
Dan Walsh a2b529ead2 --help option and help command should print to stdout not stderr
--help and help are successful commands so output should not go to error.

    QE teams have requested this change, also users doing docker help | less
    or docker run --help | less would expect this to work.

    Usage statement should only be printed when the user asks for it.
    Errors should print error message and then suggest the docker COMMAND --help
    command to see usage information.

    The current behaviour causes the user to have to search for the error message
    and sometimes scrolls right off the screen.  For example a error on a
    "docker run" command is very difficult to diagnose.

    Finally erros should always exit with a non 0 exit code, if the user
    makes a CLI error.

Docker-DCO-1.1-Signed-off-by: Dan Walsh <dwalsh@redhat.com> (github: rhatdan)
2015-01-06 13:40:14 +01:00
Qiang Huang 9cc73c62e6 flag: fix the comments
Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2014-11-30 01:58:16 +08:00
Doug Davis 88afbc4d94 Add missing unit testcase for new IsSet() func in mflag
Forgot to add this when I did PR #9259

Signed-off-by: Doug Davis <dug@us.ibm.com>
2014-11-22 05:37:36 -08:00
Doug Davis ae9bd580af Make --tlsverify enable tls regardless of value specified
I also needed to add a mflag.IsSet() function that allows you to check
to see if a certain flag was actually specified on the cmd line.

Per #9221 - also tweaked the docs to fix a typo.

Closes #9221

Signed-off-by: Doug Davis <dug@us.ibm.com>
2014-11-20 16:09:06 -08:00
Sven Dowideit f1934e5979 fs.Visit() returns nil flag
Signed-off-by: Sven Dowideit <SvenDowideit@docker.com>
2014-08-29 15:38:03 +10:00
SvenDowideit 8c6c4a12b7 add the [OPTIONS] string automatically if there are flags defined
Signed-off-by: SvenDowideit <SvenDowideit@home.org.au>

Docker-DCO-1.1-Signed-off-by: SvenDowideit <SvenDowideit@home.org.au> (github: SvenDowideit)
2014-08-28 08:50:50 +10:00
Victor Vieux 2e489073d9 Revert "--help option and help command should print to stdout not stderr"
This reverts commit 61b129d818.

Signed-off-by: Victor Vieux <vieux@docker.com>
2014-08-27 18:59:13 +00:00
Dan Walsh 61b129d818 --help option and help command should print to stdout not stderr
--help and help are successful commands so output should not go to error.

QE teams have requested this change, also users doing docker help | less
or docker run --help | less would expect this to work.

Usage statement should only be printed when the user asks for it.
Errors should print error message and then suggest the docker COMMAND --help
command to see usage information.

The current behaviour causes the user to have to search for the error message
and sometimes scrolls right off the screen.  For example a error on a
"docker run" command is very difficult to diagnose.

Finally erros should always exit with a non 0 exit code, if the user
makes a CLI error.

Docker-DCO-1.1-Signed-off-by: Dan Walsh <dwalsh@redhat.com> (github: rhatdan)
2014-08-21 15:35:20 -04:00
Victor Vieux b3ee9ac74e update go import path and libcontainer
Docker-DCO-1.1-Signed-off-by: Victor Vieux <vieux@docker.com> (github: vieux)
2014-07-24 22:19:50 +00:00
Jonathan Boulle d14cfc8d43 sort flags with the same name in a consistent order
Docker-DCO-1.1-Signed-off-by: Jonathan Boulle <jonathanboulle@gmail.com> (github: jonboulle)
2014-06-27 01:46:59 +00:00
Solomon Hykes c9e647e42f Merge pull request #6218 from vieux/update_maintainers 2014-06-25 17:00:32 -07:00
LK4D4 f08cd445b0 Fix go vet errors
Docker-DCO-1.1-Signed-off-by: Alexandr Morozov <lk4d4math@gmail.com> (github: LK4D4)

Docker-DCO-1.1-Signed-off-by: Victor Vieux <vieux@docker.com> (github: vieux)
2014-06-18 17:39:57 +00:00
Victor Vieux 661a1e9026 prevent panic when empty flag
Docker-DCO-1.1-Signed-off-by: Victor Vieux <vieux@docker.com> (github: vieux)
2014-06-17 20:45:57 +00:00
Victor Vieux 06248d745a update MAINTAINERS files
Docker-DCO-1.1-Signed-off-by: Victor Vieux <vieux@docker.com> (github: vieux)
2014-06-16 22:20:07 +00:00
cyphar e4497feaba pkg: mflag: flag: added tests for quote-stripped flags
This patch adds some tests to ensure that quoted flags are properly
handled by the mflag package.

Docker-DCO-1.1-Signed-off-by: Aleksa Sarai <cyphar@cyphar.com> (github: cyphar)
2014-06-02 15:25:38 +10:00
cyphar 0e9c40eb82 pkg: mflag: flag: make mflag strip quotes in -flag="var" forms
This patch improves the mflag package to ensure that things arguments
to mflag such as `-flag="var"` or `-flag='var'` have the quotes
stripped from the value (to mirror the getopt functionality for similar
flags).

Docker-DCO-1.1-Signed-off-by: Aleksa Sarai <cyphar@cyphar.com> (github: cyphar)
2014-06-02 15:25:33 +10:00
Victor Vieux 77098d5b5b use tabwriter to display usage in mflag
Docker-DCO-1.1-Signed-off-by: Victor Vieux <vieux@docker.com> (github: vieux)
2014-05-06 21:31:21 +00:00
Victor Vieux a41f6d9367 update godoc and add MAINTAINERS for mflags
Docker-DCO-1.1-Signed-off-by: Victor Vieux <victor.vieux@docker.com> (github: vieux)
2014-03-14 17:35:41 +00:00
Victor Vieux f0eb227548 improve deprecation message
Docker-DCO-1.1-Signed-off-by: Victor Vieux <victor.vieux@docker.com> (github: vieux)
2014-03-12 00:51:46 +00:00
Victor Vieux 7da37fec13 handle capital
Docker-DCO-1.1-Signed-off-by: Victor Vieux <victor.vieux@docker.com> (github: vieux)
2014-03-07 23:40:45 +00:00
Victor Vieux 3729ece2ea improve alpha sort in mflag
Docker-DCO-1.1-Signed-off-by: Victor Vieux <victor.vieux@docker.com> (github: vieux)
2014-03-07 02:20:59 +00:00
Victor Vieux 069dc7f8c7 fix panic with only long flags or only one deprecatd
Docker-DCO-1.1-Signed-off-by: Victor Vieux <victor.vieux@docker.com> (github: vieux)
2014-03-05 19:45:57 +00:00
Victor Vieux 089bf5e11e fix usage for completly deprecated flag
Docker-DCO-1.1-Signed-off-by: Victor Vieux <victor.vieux@docker.com> (github: vieux)
2014-03-05 19:27:39 +00:00
Victor Vieux bb5ed45224 add warning for deprecatd flags
Docker-DCO-1.1-Signed-off-by: Victor Vieux <victor.vieux@docker.com> (github: vieux)
2014-03-03 19:57:05 +00:00
Victor Vieux cb3d27d01b prevent flag grouping with --
Docker-DCO-1.1-Signed-off-by: Victor Vieux <victor.vieux@docker.com> (github: vieux)
2014-03-03 19:17:28 +00:00
Victor Vieux 3839e3a0f6 enable docker run -it
Docker-DCO-1.1-Signed-off-by: Victor Vieux <victor.vieux@docker.com> (github: vieux)
2014-02-24 22:53:00 +00:00
Victor Vieux 65794a2c49 fix panic in mflag
Docker-DCO-1.1-Signed-off-by: Victor Vieux <victor.vieux@docker.com> (github: vieux)
2014-01-31 11:39:29 -08:00
Victor Vieux c4e7b0e4d5 fix mflag import
Docker-DCO-1.1-Signed-off-by: Victor Vieux <victor.vieux@docker.com> (github: vieux)
2014-01-27 23:29:56 +00:00
Tianon Gravi f60eee4894 Fix mflag test issue with "ResetForTesting" (which only showed up under dyntest for some odd reason)
Docker-DCO-1.1-Signed-off-by: Andrew Page <admwiggin@gmail.com> (github: tianon)
2014-01-23 13:03:17 -07:00
Victor Vieux e71dbf4ee5 update commands.go
update docker.go

move to pkg

update docs

update name and copyright

change --sinceId to --since-id, update completion and docs

Docker-DCO-1.1-Signed-off-by: Victor Vieux <victor@docker.com> (github: vieux)
2014-01-17 17:33:15 -08:00