Commit graph

55 commits

Author SHA1 Message Date
Tim Wang
ecd2717cbf Update LICENSE date
Signed-off-by: Tim <timwangdev@gmail.com>
2015-12-31 13:07:35 +00:00
Justas Brazauskas
244162287a Fix typos found across repository
Signed-off-by: Justas Brazauskas <brazauskasjustas@gmail.com>
2015-12-13 18:04:12 +02:00
Morgan Bauer
47a077d28c Remove defaults for flags/options that expect no value
- isZeroValue function from upstream go
 - covers booleans, strings and numbers
 - change integration to reflect new behavior
 - resolves #9406

Signed-off-by: Morgan Bauer <mbauer@us.ibm.com>
2015-11-19 08:37:51 -08:00
Sally O'Malley
e94c4801a6 Change 'docker run' exit codes to distinguish docker/contained errors
The purpose of this PR is for users to distinguish Docker errors from
contained command errors.
This PR modifies 'docker run' exit codes to follow the chroot standard
for exit codes.
Exit status:
125 if 'docker run' itself fails
126 if contained command cannot be invoked
127 if contained command cannot be found
the exit status otherwise

Signed-off-by: Sally O'Malley <somalley@redhat.com>
2015-11-04 15:18:50 -05:00
Alexander Morozov
14396c9092 Fix golint warnings
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2015-11-02 08:02:25 -08:00
Antonio Murdaca
4ebc358c68 bump libcontainer to 902c012e85cdae6bb68d8c7a0df69a42f818ce96
Signed-off-by: Antonio Murdaca <amurdaca@redhat.com>
2015-10-06 17:55:09 +02:00
Veres Lajos
0f78f158aa typofix - https://github.com/vlajos/misspell_fixer
Signed-off-by: Veres Lajos <vlajos@gmail.com>
2015-08-07 23:25:49 +01:00
Félix Cantournet
26a545e3bc Fix golint for pkg/mflag
Signed-off-by: Félix Cantournet <felix.cantournet@cloudwatt.com>
2015-07-28 15:32:42 +02:00
Tibor Vass
0cec613de9 cli: new daemon command and new cli package
This patch creates a new cli package that allows to combine both client
and daemon commands (there is only one daemon command: docker daemon).

The `-d` and `--daemon` top-level flags are deprecated and a special
message is added to prompt the user to use `docker daemon`.

Providing top-level daemon-specific flags for client commands result
in an error message prompting the user to use `docker daemon`.

This patch does not break any old but correct usages.

This also makes `-d` and `--daemon` flags, as well as the `daemon`
command illegal in client-only binaries.

Signed-off-by: Tibor Vass <tibor@docker.com>
2015-07-23 19:44:46 -04:00
Doug Davis
ef185a9afc Carry #11858
Continues 11858 by:
- Making sure the exit code is always zero when we ask for help
- Making sure the exit code isn't zero when we print help on error cases
- Making sure both short and long usage go to the same stream (stdout vs stderr)
- Making sure all docker commands support --help
- Test that all cmds send --help to stdout, exit code 0, show full usage, no blank lines at end
- Test that all cmds (that support it) show short usage on bad arg to stderr, no blank line at end
- Test that all cmds complain about a bad option, no blank line at end
- Test that docker (w/o subcmd) does the same stuff mentioned above properly

Signed-off-by: Doug Davis <dug@us.ibm.com>
2015-05-23 09:14:18 -07:00
Jason Shepherd
a8c0208903 adding nicer help when missing arguments (#11858)
Signed-off-by: Jason Shepherd <jason@jasonshepherd.net>
2015-05-19 12:02:13 +10:00
s. rannou
08683e7133 Fix panic when using default-initialized FlagSet
Closes #13294

Signed-off-by: Sebastien Rannou <mxs@sbrk.org>
2015-05-18 11:55:38 +02:00
Lei Jitang
f0a8b6b109 Minor typo: remove redundant dot in error message in runconfig/parse.go
Signed-off-by: Lei Jitang <leijitang@huawei.com>
2015-05-13 11:04:07 +08:00
Antonio Murdaca
2026dbd41d Small if err cleaning
Signed-off-by: Antonio Murdaca <me@runcom.ninja>
2015-04-27 21:50:33 +02:00
Antonio Murdaca
8b84610fdc Refactor utils/flags.go, fixes #11892
Signed-off-by: Antonio Murdaca <me@runcom.ninja>
2015-03-29 03:22:46 +02:00
Peter Choi
ecbb2a9d58 Changed snake case naming to camelCase
Signed-off-by: Peter Choi <phkchoi89@gmail.com>
2015-03-26 15:05:45 -06:00
Ahmet Alp Balkan
718f112173 Make use of %USERPROFILE% in cli help message
An earlier commit was causing docker windows CLI build to not to pick up
the shorthand form for home directory (`%USERPROFILE%`) shown in when
`docker --help` is executed.

Fixing that bug and making the if statement concise and clear.

Signed-off-by: Ahmet Alp Balkan <ahmetalpbalkan@gmail.com>
2015-03-11 02:14:49 -07:00
Arnaud Porterie
29e7195aaf Remove subdirectories MAINTAINERS files
Signed-off-by: Arnaud Porterie <arnaud.porterie@docker.com>
2015-03-06 18:21:51 -08:00
Doug Davis
9ac0da4578 Fix for help when $HOME is /
estesp noticed that when $HOME is / the ~ substitutions messes up
becuase it tries to replace all paths that start with "/" with "~".
This fixes it so that it will only replace it when $HOME isn't "/".

Signed-off-by: Doug Davis <dug@us.ibm.com>
2015-02-19 22:21:17 -08:00
Ahmet Alp Balkan
78a51d2d2c Shorten printed Windows paths on docker help cmd
This makes use of `%USERPROFILE%` as a substitute for
`~` on Windows and prints shorter strings for default
cert paths etc.

Also removes string escaping/quotes around default
path values printed in `docker help` command as they
are not really necessary and adds double backslashes
(\\) on windows.

Signed-off-by: Ahmet Alp Balkan <ahmetalpbalkan@gmail.com>
2015-02-18 23:04:56 -08:00
Doug Davis
9bc2b3482b Pretty the help text
This modifies the "docker help" text so that it is no wider than 80 chars
and each description fits on one line. This will also try to use ~ when
possible

Added a test to make sure we don't go over 80 chars again.
Added a test to make sure we use ~

Applied rules/tests to all docker commands - not just main help text

Closes #10214

Signed-off-by: Doug Davis <dug@us.ibm.com>
2015-02-04 07:59:16 -08:00
Qiang Huang
a3bca489d0 correct the flag comments
Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2015-01-13 15:40:24 +08:00
Victor Vieux
e2b6c1fdac fix issue with goimport
Signed-off-by: Victor Vieux <vieux@docker.com>
2015-01-12 22:52:19 +00:00
Victor Vieux
288106b71b update copyrights to 2015
Signed-off-by: Victor Vieux <vieux@docker.com>
2015-01-12 22:47:36 +00:00
Michal Minar
cfb25ffb10 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
f23192465b 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
d440ff0beb 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
6c3b7f1932 --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
16130e775f flag: fix the comments
Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2014-11-30 01:58:16 +08:00
Doug Davis
0b5fa520c2 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
0a3565494b 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
6a1cc969fc fs.Visit() returns nil flag
Signed-off-by: Sven Dowideit <SvenDowideit@docker.com>
2014-08-29 15:38:03 +10:00
SvenDowideit
cf3dfd3d8b 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
bb2a94eeef 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
1d8231b230 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
e68d8598ca Merge pull request #6218 from vieux/update_maintainers 2014-06-25 17:00:32 -07:00
LK4D4
f78264e329 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
d18d9ffeaa 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
6b0164ee3f 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
c3e6f79cb3 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
4941e364a9 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
777139b650 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
eac9cae74d 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
f7fe084946 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
572ce1c6a9 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
6c4652a766 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
7339ca8699 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
a5ba28e1f7 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
ed2e85ad24 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
d1b77040a7 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