1
0
mirror of https://github.com/docker/cli.git synced 2026-10-23 19:12:36 +03:00
Files
cli/e2e
Nimesh Kulkarni e08aa72569 cmd/docker: fail on unknown command with --version
Running "docker nonexistent --version" printed the CLI version and
exited 0, so it couldn't be used to check whether a command or plugin
is available. Without "--version" the same invocation fails with an
"unknown command" error.

When no built-in command or plugin matches, runDocker falls through to
executing the root command, and cobra handles the "--version" flag
before the root command reports the unknown command. Unset the root
command's version in that fallback, so the standard unknown-command
error is returned.

A global "--version" flag ("docker --version nonexistent") is parsed
before the command name and still prints the version, as do
"docker --version" and "docker nonexistent --help".

Signed-off-by: Nimesh Kulkarni <167794819+GitNimay@users.noreply.github.com>
2026-10-19 19:35:05 +05:30
..
2025-10-31 17:45:29 +01:00
2025-10-31 17:45:29 +01:00
2026-09-02 02:50:28 +02:00