DockerCLI/cli/command/plugin
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
..
testdata feat: standardize error for prompt 2024-03-26 14:11:55 +01:00
client_test.go fix: cli prompt termination exit code 2024-03-04 15:26:17 +01:00
cmd.go Update gometalinter 2017-10-26 12:21:02 -04:00
create.go Dockerfile: update mvdan/gofumpt to v0.6.0 2024-03-17 13:48:13 +01:00
create_test.go test spring-cleaning 2024-07-04 01:35:12 +02:00
disable.go Plumb contexts through commands 2023-12-12 22:30:16 +01:00
disable_test.go cli: improve argument validation output 2024-07-05 03:35:14 +02:00
enable.go Plumb contexts through commands 2023-12-12 22:30:16 +01:00
enable_test.go cli: improve argument validation output 2024-07-05 03:35:14 +02:00
formatter.go linting: address assorted issues found by gocritic 2023-11-20 16:02:16 +01:00
formatter_test.go Update go:build comments to go1.21 2024-06-18 12:17:13 +02:00
inspect.go Update go:build comments to go1.21 2024-06-18 12:17:13 +02:00
inspect_test.go test spring-cleaning 2024-07-04 01:35:12 +02:00
install.go Plumb context to API callbacks 2024-05-17 14:39:49 +02:00
install_test.go test spring-cleaning 2024-07-04 01:35:12 +02:00
list.go Plumb contexts through commands 2023-12-12 22:30:16 +01:00
list_test.go test spring-cleaning 2024-07-04 01:35:12 +02:00
push.go Plumb contexts through commands 2023-12-12 22:30:16 +01:00
remove.go Plumb contexts through commands 2023-12-12 22:30:16 +01:00
remove_test.go test spring-cleaning 2024-07-04 01:35:12 +02:00
set.go Plumb contexts through commands 2023-12-12 22:30:16 +01:00
upgrade.go chore: remove backticks and resolve linting issues 2024-04-02 15:54:29 +02:00
upgrade_test.go test spring-cleaning 2024-07-04 01:35:12 +02:00