Commit Graph

37 Commits

Author SHA1 Message Date
5b7ee8a3f9 Fix docker invalid-subcommand regression
Starting with a3fe7d62b8,
`docker invalid-subcommand` did not exit with non-zero status.

Fix #1428

Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
(cherry picked from commit d708cada43)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: ebe071a9b3
Component: cli
2018-10-24 20:49:10 +02:00
e50a0b1358 build: only show buildkit-specific flags if buildkit is enabled
Signed-off-by: Tibor Vass <tibor@docker.com>
(cherry picked from commit bbd01fe3df)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: 3dfacb55a4
Component: cli
2018-10-12 00:16:48 +02:00
4c421251cb Remove containerizedengine package dependency from docker/cli/command…
… this removes a whole lot of dependencies from people depending on docker/cli…

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
(cherry picked from commit 2d344b2f61)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: fc3dc8f058
Component: cli
2018-09-11 17:01:02 +02:00
4f7a346b35 Scope orchestration selection to stack commands only
* Renaming DOCKER_ORCHESTRATOR to DOCKER_STACK_ORCHESTRATOR
* Renaming config file option "orchestrator" to "stackOrchestrator"
* "--orchestrator" flag is no more global but local to stack command and subcommands
* Cleaning all global orchestrator code
* Replicating Hidden flags in help and Supported flags from root command to stack command

Signed-off-by: Silvin Lubecki <silvin.lubecki@docker.com>
Upstream-commit: 71272dd203
Component: cli
2018-06-21 17:12:31 -07:00
e92ec69f61 Update tests to use gotest.tools 👼
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: 2c4de4fb5e
Component: cli
2018-06-08 18:24:26 +02:00
17705eb1b4 Fix #1113 "Segfault on --help with --tlsverify if no ca certificate is present"
Errors were not checked while initializing the docker client in the help command

Signed-off-by: Silvin Lubecki <silvin.lubecki@docker.com>
Upstream-commit: f4b0780e20
Component: cli
2018-06-08 16:14:48 +02:00
d9ce9238d8 Merge pull request #1106 from silvin-lubecki/fix-orchestrator-flag-persistent
Add a "top-level" annotation to hide persistent flags
Upstream-commit: 2014e991ee
Component: cli
2018-06-01 23:32:40 +02:00
cc8e8442e8 Added a "top-level" annotation to hide persistent flags in all sub-commands, excepting some specific commands, while printing help
Fixes issue #1099

Signed-off-by: Silvin Lubecki <silvin.lubecki@docker.com>
Upstream-commit: c003ed1f35
Component: cli
2018-06-01 15:13:40 +02:00
ee64293c17 Mark checkpoint feature as Linux-only, and homogenize error messages
This patch adds annotations to mark the checkpoint commands as Linux only, which
hides them if the daemon is running a non-matching operating-system type;

Before:

    docker

    Usage:	docker COMMAND

    A self-sufficient runtime for containers

    ...

    Management Commands:
      config      Manage Docker configs
      container   Manage containers
      image       Manage images

After:

    docker

    Usage:	docker COMMAND

    A self-sufficient runtime for containers

    ...

    Management Commands:
      checkpoint  Manage checkpoints
      config      Manage Docker configs
      container   Manage containers
      image       Manage images

This change also prints errors when attempting to use checkpoint commands or
flags if the feature is not supported by the Daemon's operating system;

    $ docker checkpoint --help
    docker checkpoint is only supported on a Docker daemon running on linux, but the Docker daemon is running on windows

    $ docker checkpoint create --help
    docker checkpoint create is only supported on a Docker daemon running on linux, but the Docker daemon is running on windows

    $ docker checkpoint ls --help
    docker checkpoint ls is only supported on a Docker daemon running on linux, but the Docker daemon is running on windows

    $ docker checkpoint rm --help
    docker checkpoint rm is only supported on a Docker daemon running on linux, but the Docker daemon is running on windows

    $ docker container start --checkpoint=foo mycontainer
    "--checkpoint" requires the Docker daemon to run on linux, but the Docker daemon is running on windows

    $ docker container start --checkpoint-dir=/foo/bar mycontainer
    "--checkpoint-dir" requires the Docker daemon to run on linux, but the Docker daemon is running on windows

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: 1df6b68111
Component: cli
2018-05-31 22:25:06 +02:00
e1b9b6c0be Remove experimentalCli annotation from all kubernetes flags and commands
Signed-off-by: Silvin Lubecki <silvin.lubecki@docker.com>
Upstream-commit: f2b75a879a
Component: cli
2018-05-28 15:06:31 +02:00
108f480da7 --orchestrator flag is now a persistent flag
Signed-off-by: Silvin Lubecki <silvin.lubecki@docker.com>
Upstream-commit: 770daef564
Component: cli
2018-05-28 10:43:32 +02:00
31fc695941 Hide [flags] in usage output
This patch hides the [flags] in the usage output of commands, using the
new `.DisableFlagsInUseLine` option, instead of the temporary workaround
added in 8e600e10f7

Before this change:

    docker run
    "docker run" requires at least 1 argument.
    See 'docker run --help'.

    Usage:  docker run [OPTIONS] IMAGE [COMMAND] [ARG...] [flags]

    Run a command in a new container

After this change:

    docker run
    "docker run" requires at least 1 argument.
    See 'docker run --help'.

    Usage:  docker run [OPTIONS] IMAGE [COMMAND] [ARG...]

    Run a command in a new container

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: 00d080269a
Component: cli
2018-05-19 02:51:55 +02:00
6e165aeab9 Use Cobra built-in --version feature
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: a3fe7d62b8
Component: cli
2018-05-19 02:51:43 +02:00
fb08bdcb4b Small content trust enhancement
- `replaceDockerfileForContentTrust` is only used when content trust is
  enabled, so remove the boolean.
- rename `isContentTrustEnabled` to `contentTrustEnabled`

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: 63ebcae382
Component: cli
2018-03-14 17:55:19 +01:00
5e391186a8 Refactor content_trust cli/flags handling
Remove the global variable used. Allows easier unit testing.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: 6e21829af4
Component: cli
2018-03-08 15:00:43 -05:00
ef941c7ad3 Convert assert.Check(t, is.Error()) to assert.Error
git grep -l -P '^\s+assert\.Check\(t, is\.Error\(' | \
    xargs perl -pi -e 's/^(\s+assert\.)Check\(t, is\.Error\((.*)\)$/\1Error(t, \2/'

Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: e15b208e96
Component: cli
2018-03-06 16:00:28 -05:00
dd7eb35a89 Convert to assert.NilError
Using:

  git grep -l '^\s\+assert\.Check(t, err)$' | \
    xargs sed -i -e 's/^\(\s\+assert\)\.Check(t, err)$/\1.NilError(t, err)/'

Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: baf65a5502
Component: cli
2018-03-06 15:27:34 -05:00
ad1a2c9e1d Automated migration
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 39c2ca57c1
Component: cli
2018-03-05 19:41:17 -05:00
fe9a519a3b Annotate "stack" commands to be "swarm" and "kubernetes"
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: 93c36eb228
Component: cli
2018-01-22 15:44:47 -08:00
4db79d6583 golint: remove redundant ifs
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: d845b4d36a
Component: cli
2018-01-13 13:16:34 +01:00
3e3e540e8d Fix PR comments
- More strict on orchestrator flag
- Make orchestrator flag more explicit as experimental
- Add experimentalCLI annotation on kubernetes flags
- Better kubeconfig error message
- Prefix service name with stackname in ps and services stack subcommands
- Fix yaml documentation
- Fix code coverage ignoring generated code

Signed-off-by: Silvin Lubecki <silvin.lubecki@docker.com>
Upstream-commit: f1b116179f
Component: cli
2018-01-03 10:23:32 +01:00
cb8fda044c Activate kubernetes only when experimental cli is enabled
* Refactor tests on version and kubernetes switch
* Fix rebase errors
* Refactor for gocyclo linter

Signed-off-by: Silvin Lubecki <silvin.lubecki@docker.com>
Upstream-commit: ad409767bf
Component: cli
2017-12-28 14:40:10 +01:00
effda473ed Set a global orchestrator flag
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: 5d375b348a
Component: cli
2017-12-28 14:40:10 +01:00
baa35d70b2 Refactor stack command
- Define command and subcommands only once
- Use annotations for k8s or swarm specific flags or subcommands

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: dedd0db51a
Component: cli
2017-12-26 11:45:56 +01:00
2a46f74679 Add support for experimental Cli configuration
Allow to mark some commands and flags experimental on cli (i.e. not
depending to the state of the daemon). This will allow more flexibility
on experimentation with the cli.

Marking `docker trust` as cli experimental as it is documented so.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: 84fe1a1b5b
Component: cli
2017-12-22 14:48:47 +01:00
293c21ca60 Remove deprecated "daemon" subcommand
The `docker daemon` subcommand was only present for
backward compatibility, but deprecated in v1.13,
and scheduled for removal in v17.12

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: c6a3199236
Component: cli
2017-11-13 19:01:35 +01:00
2e5b6e24c7 Update code for upstream cobra
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 4205416c9b
Component: cli
2017-10-25 14:49:26 -04:00
4bafd44516 updated vendoring
Signed-off-by: Simon Ferquel <simon.ferquel@docker.com>
Upstream-commit: a0113c3a44
Component: cli
2017-09-01 19:41:06 -04:00
2bf9a1e1f5 fixed the output leak from daemon unit tests
Signed-off-by: Arash Deshmeh <adeshmeh@ca.ibm.com>
Upstream-commit: 69b226a89c
Component: cli
2017-06-27 14:22:49 -04:00
d7802c7d2b Add windows resources to binary.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 8a6ad48d2b
Component: cli
2017-05-15 18:03:03 -04:00
bfb4425b6f Display proper version information
- The cli version defaults to "unknown-version" unless set via the VERSION env var
- The commit version can be overridden via GITCOMMIT env var
- The build time can be overridden via BUILDTIME env var

Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
Upstream-commit: cf51bde7d9
Component: cli
2017-05-09 14:22:51 -07:00
edf78faba7 Add interfacer linter
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 37ccc00d0e
Component: cli
2017-05-08 15:57:50 -04:00
82b8acb640 rm client and vendor it instead
Signed-off-by: Tibor Vass <tibor@docker.com>
Upstream-commit: 57230a7212
Component: cli
2017-05-08 10:33:56 -07:00
8ef7f9b38c windows: remove workaround for go#15286 and have compiling work on windows
Signed-off-by: Tibor Vass <tibor@docker.com>
Upstream-commit: 97a4da4cf1
Component: cli
2017-04-25 15:53:23 -07:00
c0890fae22 Add a Dockerfile for building and testing.
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
Upstream-commit: b6cba06801
Component: cli
2017-04-18 19:12:24 -04:00
82309a74cd Update imports.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 10641c2aae
Component: cli
2017-04-17 18:07:56 -04:00
0890ccc8cb Import docker/docker/cmd/docker
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
Upstream-commit: cdd7bc516b
Component: cli
2017-04-17 17:44:40 -04:00