More cleanup for failures on missing commands.

Currently in podman if a user specifies a command that does not exist
the tool shows the help information.  This patch changes it to show
information like:

$ ./bin/podman foobar
Error: unrecognized command 'podman foobar'
Try 'podman --help' for more information.
$ ./bin/podman volume foobar
Error: unrecognized command `podman volume foobar`
Try 'podman volume --help' for more information.
$ ./bin/podman container foobar
Error: unrecognized command `podman container foobar`
Try 'podman container --help' for more information.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
Daniel J Walsh
2019-03-07 16:44:39 -05:00
parent 94e89fc6ca
commit 181f327d57
11 changed files with 22 additions and 5 deletions

View File

@@ -82,9 +82,7 @@ var cmdsNotRequiringRootless = map[*cobra.Command]bool{
var rootCmd = &cobra.Command{
Use: "podman",
Long: "manage pods and images",
RunE: func(cmd *cobra.Command, args []string) error {
return cmd.Help()
},
RunE: commandRunE(),
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
return before(cmd, args)
},