mirror of https://github.com/containers/podman.git
Keep error semantics intact
Signed-off-by: Markus Thömmes <markusthoemmes@me.com>
This commit is contained in:
parent
184de3955c
commit
756dda298c
|
@ -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 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
|
// IDOrLatestArgs used to validate a nameOrId was provided or the "--latest" flag
|
||||||
|
|
|
@ -100,7 +100,7 @@ function setup() {
|
||||||
skip "only applicable on a local run since this requires no endpoint"
|
skip "only applicable on a local run since this requires no endpoint"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
run_podman --remote
|
run_podman 125 --remote
|
||||||
is "$output" ".*Usage:" "podman --remote show usage message without running endpoint"
|
is "$output" ".*Usage:" "podman --remote show usage message without running endpoint"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -143,16 +143,13 @@ function check_help() {
|
||||||
count=$(expr $count + 1)
|
count=$(expr $count + 1)
|
||||||
done
|
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.
|
# without one.
|
||||||
dprint "podman $@"
|
dprint "podman $@"
|
||||||
|
run_podman '?' "$@"
|
||||||
# Store the output of the actual --help command
|
is "$status" 125 "'podman $*' without any subcommand - exit status"
|
||||||
run_podman "$@" --help
|
is "$output" ".*Usage:.*Error: missing command '.*$@ COMMAND'" \
|
||||||
local full_help="$output"
|
"'podman $*' without any subcommand - expected error message"
|
||||||
|
|
||||||
run_podman "$@"
|
|
||||||
is "$output" "$full_help" "'podman $*' without any subcommand - expected help message"
|
|
||||||
|
|
||||||
# Assume that 'NoSuchCommand' is not a command
|
# Assume that 'NoSuchCommand' is not a command
|
||||||
dprint "podman $@ NoSuchCommand"
|
dprint "podman $@ NoSuchCommand"
|
||||||
|
|
Loading…
Reference in New Issue