DockerCLI/cli/command/checkpoint
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 add unit tests to cli/command/checkpoint package 2017-06-30 17:17:47 -04:00
client_test.go vendor: github.com/docker/docker a65c948e7edf (v25.0.0-dev) 2023-08-28 21:11:17 +02:00
cmd.go Mark checkpoint feature as Linux-only, and homogenize error messages 2018-05-31 22:25:06 +02:00
create.go cli/command: don't use pflags.XXXVarP for flags without shorthand 2024-01-29 11:16:38 +01:00
create_test.go cli: improve argument validation output 2024-07-05 03:35:14 +02:00
formatter.go linting: address else/if/elseif statements found by gocritic 2023-11-20 16:02:16 +01:00
formatter_test.go vendor: github.com/docker/docker a65c948e7edf (v25.0.0-dev) 2023-08-28 21:11:17 +02:00
list.go cli/command: don't use pflags.XXXVarP for flags without shorthand 2024-01-29 11:16:38 +01:00
list_test.go cli: improve argument validation output 2024-07-05 03:35:14 +02:00
remove.go cli/command: don't use pflags.XXXVarP for flags without shorthand 2024-01-29 11:16:38 +01:00
remove_test.go cli: improve argument validation output 2024-07-05 03:35:14 +02:00