Merge pull request #5234 from thaJeztah/nicer_missing_commands
cli: improve output and consistency for unknown (sub)commands
This commit is contained in:
@ -82,7 +82,7 @@ func newDockerCommand(dockerCli *command.DockerCli) *cli.TopLevelCommand {
|
||||
if len(args) == 0 {
|
||||
return command.ShowHelp(dockerCli.Err())(cmd, args)
|
||||
}
|
||||
return fmt.Errorf("docker: '%s' is not a docker command.\nSee 'docker --help'", args[0])
|
||||
return fmt.Errorf("docker: unknown command: docker %s\n\nRun 'docker --help' for more information", args[0])
|
||||
},
|
||||
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
|
||||
return isSupported(cmd, dockerCli)
|
||||
|
||||
@ -66,7 +66,7 @@ func TestExitStatusForInvalidSubcommandWithHelpFlag(t *testing.T) {
|
||||
|
||||
func TestExitStatusForInvalidSubcommand(t *testing.T) {
|
||||
err := runCliCommand(t, nil, nil, "invalid")
|
||||
assert.Check(t, is.ErrorContains(err, "docker: 'invalid' is not a docker command."))
|
||||
assert.Check(t, is.ErrorContains(err, "docker: unknown command: docker invalid"))
|
||||
}
|
||||
|
||||
func TestVersion(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user