DockerCLI/cmd/docker
Sebastiaan van Stijn c60b360c33
cli: improve argument validation output
Improve the output for these validation errors:

- Removes the short command description from the output. This information
  does not provide much useful help, and distracts from the error message.
- Reduces punctuation, and
- Prefixes the error message with the binary / root-command name
  (usually `docker:`) to be consistent with other similar errors.
- Adds an empty line between the error-message and the "call to action"
  (`Run 'docker volume --help'...` in the example below). This helps
  separating the error message and "usage" from the call-to-action.

Before this patch:

    $ docker volume ls one two three
    "docker volume ls" accepts no arguments.
    See 'docker volume ls --help'.

    Usage:  docker volume ls [OPTIONS]

    List volumes

    $ docker volume create one two three
    "docker volume create" requires at most 1 argument.
    See 'docker volume create --help'.

    Usage:  docker volume create [OPTIONS] [VOLUME]

    Create a volume

With this patch:

    $ docker volume ls one two three
    docker: 'docker volume ls' accepts no arguments

    Usage:  docker volume ls [OPTIONS]

    Run 'docker volume ls --help' for more information

    $ docker voludocker volume create one two three
    docker: 'docker volume create' requires at most 1 argument

    Usage:  docker volume create [OPTIONS] [VOLUME]

    SRun 'docker volume create --help' for more information

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-07-05 03:35:14 +02:00
..
internal/signals cli-plugins: terminate plugin when CLI exits 2023-12-12 13:54:30 +00:00
winresources Use goversioninfo to create Windows Version Info 2021-10-11 16:54:22 +02:00
aliases.go build: set default context builder if not specified 2022-11-04 08:42:34 +01:00
builder.go build: allow BuildKit to be used on Windows daemons that advertise it 2024-06-20 02:49:22 +02:00
builder_test.go Update go:build comments to go1.21 2024-06-18 12:17:13 +02:00
builder_windows_test.go build: set default context builder if not specified 2022-11-04 08:42:34 +01:00
completions.go cmd/docker: registerCompletionFuncForGlobalFlags: take store.Store as argument 2024-01-11 22:31:17 +01:00
docker.go cli: improve output and consistency for unknown (sub)commands 2024-07-05 02:28:11 +02:00
docker_test.go cli: improve argument validation output 2024-07-05 03:35:14 +02:00
docker_windows_386.go remove pre-go1.17 build-tags 2023-05-05 18:23:03 +02:00
docker_windows_amd64.go remove pre-go1.17 build-tags 2023-05-05 18:23:03 +02:00
docker_windows_arm.go remove pre-go1.17 build-tags 2023-05-05 18:23:03 +02:00
docker_windows_arm64.go remove pre-go1.17 build-tags 2023-05-05 18:23:03 +02:00