summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmd/podman/validate/args.go3
-rw-r--r--test/system/001-basic.bats2
-rw-r--r--test/system/015-help.bats13
3 files changed, 8 insertions, 10 deletions
diff --git a/cmd/podman/validate/args.go b/cmd/podman/validate/args.go
index dde45cc29..6b5425a69 100644
--- a/cmd/podman/validate/args.go
+++ b/cmd/podman/validate/args.go
@@ -27,7 +27,8 @@ func SubCommandExists(cmd *cobra.Command, args []string) error {
}
return errors.Errorf("unrecognized command `%[1]s %[2]s`\n\nDid you mean this?\n\t%[3]s\n\nTry '%[1]s --help' for more information.", cmd.CommandPath(), args[0], strings.Join(suggestions, "\n\t"))
}
- return cmd.Help()
+ cmd.Help()
+ return errors.Errorf("missing command '%[1]s COMMAND'", cmd.CommandPath())
}
// IDOrLatestArgs used to validate a nameOrId was provided or the "--latest" flag
diff --git a/test/system/001-basic.bats b/test/system/001-basic.bats
index 2a6f4bea0..ccc05bb15 100644
--- a/test/system/001-basic.bats
+++ b/test/system/001-basic.bats
@@ -100,7 +100,7 @@ function setup() {
skip "only applicable on a local run since this requires no endpoint"
fi
- run_podman --remote
+ run_podman 125 --remote
is "$output" ".*Usage:" "podman --remote show usage message without running endpoint"
}
diff --git a/test/system/015-help.bats b/test/system/015-help.bats
index 51660ba12..b2c6e2575 100644
--- a/test/system/015-help.bats
+++ b/test/system/015-help.bats
@@ -143,16 +143,13 @@ function check_help() {
count=$(expr $count + 1)
done
- # Any command that takes subcommands, prints its help if called
+ # Any command that takes subcommands, prints its help and errors if called
# without one.
dprint "podman $@"
-
- # Store the output of the actual --help command
- run_podman "$@" --help
- local full_help="$output"
-
- run_podman "$@"
- is "$output" "$full_help" "'podman $*' without any subcommand - expected help message"
+ run_podman '?' "$@"
+ is "$status" 125 "'podman $*' without any subcommand - exit status"
+ is "$output" ".*Usage:.*Error: missing command '.*$@ COMMAND'" \
+ "'podman $*' without any subcommand - expected error message"
# Assume that 'NoSuchCommand' is not a command
dprint "podman $@ NoSuchCommand"