8f3798cf04
In the initial implementation I thought it would be good to not pass on the deprecation to plugins (since they are new). However it turns out this causes `docker helloworld -h` to print a spurious "pflag: help requested" line: $ docker helloworld -h pflag: help requested See 'docker helloworld --help'. Usage: docker helloworld [OPTIONS] COMMAND A basic Hello World plugin for tests ... Compared with: $ docker ps -h Flag shorthand -h has been deprecated, please use --help Usage: docker ps [OPTIONS] This is in essence because having the flag undefined hits a different path within cobra, causing `c.execute()` to return early due to getting an error (`flag.ErrHelp`) from `c.ParseFlags`, which launders the error through our `FlagErrorFunc` which wraps it in a `StatusError` which in turn defeats an `if err == flag.ErrHelp` check further up the call chain. If the flag is defined we instead hit a path which returns a bare `flag.ErrHelp` without wrapping it. I considered updating our `FlagErrorFunc` to not wrap `flag.ErrHelp` (and then following the chain to the next thing) however while doing that I realised that the code for `-h` (and `--help`) is deeply embedded into cobra (and its flags library) such that actually using `-h` as a plugin argument meaning something other than `help` is basically impossible/impractical. Therefore we may as well have plugins behave identically to the monolithic CLI and support (deprecated) the `-h` argument. With this changed the help related blocks of `SetupRootCommand` and `SetupPluginRootCommand` are now identical, so consolidate into `setupCommonRootCommand`. Tests are updated to check `-h` in a variety of scenarios, including the happy case here. Signed-off-by: Ian Campbell <ijc@docker.com> |
||
---|---|---|
.github | ||
cli | ||
cli-plugins | ||
cmd/docker | ||
contrib/completion | ||
dockerfiles | ||
docs | ||
e2e | ||
experimental | ||
internal | ||
kubernetes | ||
man | ||
opts | ||
scripts | ||
service/logs | ||
templates | ||
types | ||
vendor | ||
.dockerignore | ||
.gitignore | ||
.mailmap | ||
AUTHORS | ||
CONTRIBUTING.md | ||
Jenkinsfile | ||
LICENSE | ||
MAINTAINERS | ||
Makefile | ||
NOTICE | ||
README.md | ||
TESTING.md | ||
VERSION | ||
appveyor.yml | ||
circle.yml | ||
codecov.yml | ||
docker.Makefile | ||
gometalinter.json | ||
poule.yml | ||
vendor.conf |
README.md
docker/cli
This repository is the home of the cli used in the Docker CE and Docker EE products.
Development
docker/cli
is developed using Docker.
Build a linux binary:
$ make -f docker.Makefile binary
Build binaries for all supported platforms:
$ make -f docker.Makefile cross
Run all linting:
$ make -f docker.Makefile lint
List all the available targets:
$ make help
In-container development environment
Start an interactive development environment:
$ make -f docker.Makefile shell
In the development environment you can run many tasks, including build binaries:
$ make binary
Legal
Brought to you courtesy of our legal counsel. For more context, please see the NOTICE document in this repo.
Use and transfer of Docker may be subject to certain restrictions by the United States and other governments.
It is your responsibility to ensure that your use and/or transfer does not violate applicable laws.
For more information, please see https://www.bis.doc.gov
Licensing
docker/cli is licensed under the Apache License, Version 2.0. See LICENSE for the full license text.