diff options
57 files changed, 216 insertions, 148 deletions
diff --git a/cmd/podman/attach.go b/cmd/podman/attach.go index 91c5f654d..5b58c022a 100644 --- a/cmd/podman/attach.go +++ b/cmd/podman/attach.go @@ -27,12 +27,13 @@ var ( } attachDescription = "The podman attach command allows you to attach to a running container using the container's ID or name, either to view its ongoing output or to control it interactively." attachCommand = cli.Command{ - Name: "attach", - Usage: "Attach to a running container", - Description: attachDescription, - Flags: attachFlags, - Action: attachCmd, - ArgsUsage: "", + Name: "attach", + Usage: "Attach to a running container", + Description: attachDescription, + Flags: attachFlags, + Action: attachCmd, + ArgsUsage: "", + OnUsageError: usageErrorHandler, } ) diff --git a/cmd/podman/build.go b/cmd/podman/build.go index 6671c18c7..d229cde03 100644 --- a/cmd/podman/build.go +++ b/cmd/podman/build.go @@ -28,6 +28,7 @@ var ( Action: buildCmd, ArgsUsage: "CONTEXT-DIRECTORY | URL", SkipArgReorder: true, + OnUsageError: usageErrorHandler, } ) diff --git a/cmd/podman/cleanup.go b/cmd/podman/cleanup.go index a71b3f48a..6ebb682ed 100644 --- a/cmd/podman/cleanup.go +++ b/cmd/podman/cleanup.go @@ -24,12 +24,13 @@ var ( Cleans up mount points and network stacks on one or more containers from the host. The container name or ID can be used. This command is used internally when running containers, but can also be used if container cleanup has failed when a container exits. ` cleanupCommand = cli.Command{ - Name: "cleanup", - Usage: "Cleanup network and mountpoints of one or more containers", - Description: cleanupDescription, - Flags: cleanupFlags, - Action: cleanupCmd, - ArgsUsage: "CONTAINER-NAME [CONTAINER-NAME ...]", + Name: "cleanup", + Usage: "Cleanup network and mountpoints of one or more containers", + Description: cleanupDescription, + Flags: cleanupFlags, + Action: cleanupCmd, + ArgsUsage: "CONTAINER-NAME [CONTAINER-NAME ...]", + OnUsageError: usageErrorHandler, } ) diff --git a/cmd/podman/commit.go b/cmd/podman/commit.go index 03210dc35..517eefd07 100644 --- a/cmd/podman/commit.go +++ b/cmd/podman/commit.go @@ -49,12 +49,13 @@ var ( set the commit message with the --message flag, and make changes to the instructions with the --change flag.` commitCommand = cli.Command{ - Name: "commit", - Usage: "Create new image based on the changed container", - Description: commitDescription, - Flags: commitFlags, - Action: commitCmd, - ArgsUsage: "CONTAINER [REPOSITORY[:TAG]]", + Name: "commit", + Usage: "Create new image based on the changed container", + Description: commitDescription, + Flags: commitFlags, + Action: commitCmd, + ArgsUsage: "CONTAINER [REPOSITORY[:TAG]]", + OnUsageError: usageErrorHandler, } ) diff --git a/cmd/podman/common.go b/cmd/podman/common.go index 4ddfd5e0a..3d0f1159f 100644 --- a/cmd/podman/common.go +++ b/cmd/podman/common.go @@ -2,6 +2,7 @@ package main import ( "context" + "fmt" "reflect" "regexp" "strings" @@ -42,6 +43,14 @@ func shortID(id string) string { return id } +func usageErrorHandler(context *cli.Context, err error, _ bool) error { + cmd := context.App.Name + if len(context.Command.Name) > 0 { + cmd = cmd + " " + context.Command.Name + } + return fmt.Errorf("%s\nSee '%s --help'.", err, cmd) +} + // validateFlags searches for StringFlags or StringSlice flags that never had // a value set. This commonly occurs when the CLI mistakenly takes the next // option and uses it as a value. diff --git a/cmd/podman/container.go b/cmd/podman/container.go index 36f706258..b73fb7a94 100644 --- a/cmd/podman/container.go +++ b/cmd/podman/container.go @@ -43,5 +43,6 @@ var ( ArgsUsage: "", Subcommands: subCommands, UseShortOptionHandling: true, + OnUsageError: usageErrorHandler, } ) diff --git a/cmd/podman/create.go b/cmd/podman/create.go index 6b5151c1b..209064eff 100644 --- a/cmd/podman/create.go +++ b/cmd/podman/create.go @@ -52,6 +52,7 @@ var createCommand = cli.Command{ HideHelp: true, SkipArgReorder: true, UseShortOptionHandling: true, + OnUsageError: usageErrorHandler, } func createCmd(c *cli.Context) error { diff --git a/cmd/podman/diff.go b/cmd/podman/diff.go index f5a2d60ad..dc35ea5a3 100644 --- a/cmd/podman/diff.go +++ b/cmd/podman/diff.go @@ -48,12 +48,13 @@ var ( container or image will be compared to its parent layer`) diffCommand = cli.Command{ - Name: "diff", - Usage: "Inspect changes on container's file systems", - Description: diffDescription, - Flags: diffFlags, - Action: diffCmd, - ArgsUsage: "ID-NAME", + Name: "diff", + Usage: "Inspect changes on container's file systems", + Description: diffDescription, + Flags: diffFlags, + Action: diffCmd, + ArgsUsage: "ID-NAME", + OnUsageError: usageErrorHandler, } ) diff --git a/cmd/podman/exec.go b/cmd/podman/exec.go index ed11b3c4b..38cee67d6 100644 --- a/cmd/podman/exec.go +++ b/cmd/podman/exec.go @@ -51,6 +51,7 @@ var ( ArgsUsage: "CONTAINER-NAME", SkipArgReorder: true, UseShortOptionHandling: true, + OnUsageError: usageErrorHandler, } ) diff --git a/cmd/podman/export.go b/cmd/podman/export.go index 20faac7d8..dd73c8663 100644 --- a/cmd/podman/export.go +++ b/cmd/podman/export.go @@ -20,12 +20,13 @@ var ( exportDescription = "Exports container's filesystem contents as a tar archive" + " and saves it on the local machine." exportCommand = cli.Command{ - Name: "export", - Usage: "Export container's filesystem contents as a tar archive", - Description: exportDescription, - Flags: exportFlags, - Action: exportCmd, - ArgsUsage: "CONTAINER", + Name: "export", + Usage: "Export container's filesystem contents as a tar archive", + Description: exportDescription, + Flags: exportFlags, + Action: exportCmd, + ArgsUsage: "CONTAINER", + OnUsageError: usageErrorHandler, } ) diff --git a/cmd/podman/history.go b/cmd/podman/history.go index 2ae0dff66..35f71dc60 100644 --- a/cmd/podman/history.go +++ b/cmd/podman/history.go @@ -63,6 +63,7 @@ var ( Action: historyCmd, ArgsUsage: "", UseShortOptionHandling: true, + OnUsageError: usageErrorHandler, } ) diff --git a/cmd/podman/image.go b/cmd/podman/image.go index 9a07d0a0c..e67f61799 100644 --- a/cmd/podman/image.go +++ b/cmd/podman/image.go @@ -28,5 +28,6 @@ var ( ArgsUsage: "", Subcommands: imageSubCommands, UseShortOptionHandling: true, + OnUsageError: usageErrorHandler, } ) diff --git a/cmd/podman/images.go b/cmd/podman/images.go index 024b6e240..4cf819f3c 100644 --- a/cmd/podman/images.go +++ b/cmd/podman/images.go @@ -128,6 +128,7 @@ var ( Action: imagesCmd, ArgsUsage: "", UseShortOptionHandling: true, + OnUsageError: usageErrorHandler, } lsImagesCommand = cli.Command{ Name: "ls", @@ -137,6 +138,7 @@ var ( Action: imagesCmd, ArgsUsage: "", UseShortOptionHandling: true, + OnUsageError: usageErrorHandler, } ) diff --git a/cmd/podman/import.go b/cmd/podman/import.go index 4f7786c42..c663e7128 100644 --- a/cmd/podman/import.go +++ b/cmd/podman/import.go @@ -36,12 +36,13 @@ var ( Optionally tag the image. You can specify the instructions using the --change option. ` importCommand = cli.Command{ - Name: "import", - Usage: "Import a tarball to create a filesystem image", - Description: importDescription, - Flags: importFlags, - Action: importCmd, - ArgsUsage: "TARBALL [REFERENCE]", + Name: "import", + Usage: "Import a tarball to create a filesystem image", + Description: importDescription, + Flags: importFlags, + Action: importCmd, + ArgsUsage: "TARBALL [REFERENCE]", + OnUsageError: usageErrorHandler, } ) diff --git a/cmd/podman/info.go b/cmd/podman/info.go index cd66943a4..927bf57be 100644 --- a/cmd/podman/info.go +++ b/cmd/podman/info.go @@ -13,12 +13,13 @@ import ( var ( infoDescription = "Display podman system information" infoCommand = cli.Command{ - Name: "info", - Usage: infoDescription, - Description: `Information display here pertain to the host, current storage stats, and build of podman. Useful for the user and when reporting issues.`, - Flags: infoFlags, - Action: infoCmd, - ArgsUsage: "", + Name: "info", + Usage: infoDescription, + Description: `Information display here pertain to the host, current storage stats, and build of podman. Useful for the user and when reporting issues.`, + Flags: infoFlags, + Action: infoCmd, + ArgsUsage: "", + OnUsageError: usageErrorHandler, } infoFlags = []cli.Flag{ cli.BoolFlag{ diff --git a/cmd/podman/inspect.go b/cmd/podman/inspect.go index a36f8c7a1..f4c460777 100644 --- a/cmd/podman/inspect.go +++ b/cmd/podman/inspect.go @@ -38,12 +38,13 @@ var ( } inspectDescription = "This displays the low-level information on containers and images identified by name or ID. By default, this will render all results in a JSON array. If the container and image have the same name, this will return container JSON for unspecified type." inspectCommand = cli.Command{ - Name: "inspect", - Usage: "Displays the configuration of a container or image", - Description: inspectDescription, - Flags: inspectFlags, - Action: inspectCmd, - ArgsUsage: "CONTAINER-OR-IMAGE [CONTAINER-OR-IMAGE]...", + Name: "inspect", + Usage: "Displays the configuration of a container or image", + Description: inspectDescription, + Flags: inspectFlags, + Action: inspectCmd, + ArgsUsage: "CONTAINER-OR-IMAGE [CONTAINER-OR-IMAGE]...", + OnUsageError: usageErrorHandler, } ) diff --git a/cmd/podman/kill.go b/cmd/podman/kill.go index 927d22ba7..f80d77b8f 100644 --- a/cmd/podman/kill.go +++ b/cmd/podman/kill.go @@ -30,6 +30,7 @@ var ( Action: killCmd, ArgsUsage: "[CONTAINER_NAME_OR_ID]", UseShortOptionHandling: true, + OnUsageError: usageErrorHandler, } ) diff --git a/cmd/podman/load.go b/cmd/podman/load.go index fbc1f3cd0..4dc5c1e3a 100644 --- a/cmd/podman/load.go +++ b/cmd/podman/load.go @@ -33,12 +33,13 @@ var ( } loadDescription = "Loads the image from docker-archive stored on the local machine." loadCommand = cli.Command{ - Name: "load", - Usage: "Load an image from docker archive", - Description: loadDescription, - Flags: loadFlags, - Action: loadCmd, - ArgsUsage: "", + Name: "load", + Usage: "Load an image from docker archive", + Description: loadDescription, + Flags: loadFlags, + Action: loadCmd, + ArgsUsage: "", + OnUsageError: usageErrorHandler, } ) diff --git a/cmd/podman/login.go b/cmd/podman/login.go index 92417e1a1..afbd180f8 100644 --- a/cmd/podman/login.go +++ b/cmd/podman/login.go @@ -40,12 +40,13 @@ var ( } loginDescription = "Login to a container registry on a specified server." loginCommand = cli.Command{ - Name: "login", - Usage: "Login to a container registry", - Description: loginDescription, - Flags: loginFlags, - Action: loginCmd, - ArgsUsage: "REGISTRY", + Name: "login", + Usage: "Login to a container registry", + Description: loginDescription, + Flags: loginFlags, + Action: loginCmd, + ArgsUsage: "REGISTRY", + OnUsageError: usageErrorHandler, } ) diff --git a/cmd/podman/logout.go b/cmd/podman/logout.go index 97631f827..fa77df2ab 100644 --- a/cmd/podman/logout.go +++ b/cmd/podman/logout.go @@ -22,12 +22,13 @@ var ( } logoutDescription = "Remove the cached username and password for the registry." logoutCommand = cli.Command{ - Name: "logout", - Usage: "Logout of a container registry", - Description: logoutDescription, - Flags: logoutFlags, - Action: logoutCmd, - ArgsUsage: "REGISTRY", + Name: "logout", + Usage: "Logout of a container registry", + Description: logoutDescription, + Flags: logoutFlags, + Action: logoutCmd, + ArgsUsage: "REGISTRY", + OnUsageError: usageErrorHandler, } ) diff --git a/cmd/podman/logs.go b/cmd/podman/logs.go index 67ec038c3..555c65fa5 100644 --- a/cmd/podman/logs.go +++ b/cmd/podman/logs.go @@ -58,6 +58,7 @@ var ( Action: logsCmd, ArgsUsage: "CONTAINER", SkipArgReorder: true, + OnUsageError: usageErrorHandler, } ) diff --git a/cmd/podman/main.go b/cmd/podman/main.go index c82c018fa..24d30fd0e 100644 --- a/cmd/podman/main.go +++ b/cmd/podman/main.go @@ -51,6 +51,7 @@ func main() { app := cli.NewApp() app.Name = "podman" app.Usage = "manage pods and images" + app.OnUsageError = usageErrorHandler app.Version = version.Version diff --git a/cmd/podman/mount.go b/cmd/podman/mount.go index 6cda9dbd3..fbaf2baf1 100644 --- a/cmd/podman/mount.go +++ b/cmd/podman/mount.go @@ -31,12 +31,13 @@ var ( }, } mountCommand = cli.Command{ - Name: "mount", - Usage: "Mount a working container's root filesystem", - Description: mountDescription, - Action: mountCmd, - ArgsUsage: "[CONTAINER-NAME-OR-ID [...]]", - Flags: mountFlags, + Name: "mount", + Usage: "Mount a working container's root filesystem", + Description: mountDescription, + Action: mountCmd, + ArgsUsage: "[CONTAINER-NAME-OR-ID [...]]", + Flags: mountFlags, + OnUsageError: usageErrorHandler, } ) diff --git a/cmd/podman/pause.go b/cmd/podman/pause.go index e8a576599..e6224dcd2 100644 --- a/cmd/podman/pause.go +++ b/cmd/podman/pause.go @@ -16,11 +16,12 @@ var ( Pauses one or more running containers. The container name or ID can be used. ` pauseCommand = cli.Command{ - Name: "pause", - Usage: "Pauses all the processes in one or more containers", - Description: pauseDescription, - Action: pauseCmd, - ArgsUsage: "CONTAINER-NAME [CONTAINER-NAME ...]", + Name: "pause", + Usage: "Pauses all the processes in one or more containers", + Description: pauseDescription, + Action: pauseCmd, + ArgsUsage: "CONTAINER-NAME [CONTAINER-NAME ...]", + OnUsageError: usageErrorHandler, } ) diff --git a/cmd/podman/pod.go b/cmd/podman/pod.go index dde43f77c..0c6ec5e8c 100644 --- a/cmd/podman/pod.go +++ b/cmd/podman/pod.go @@ -29,5 +29,6 @@ Pods are a group of one or more containers sharing the same network, pid and ipc Description: podDescription, UseShortOptionHandling: true, Subcommands: podSubCommands, + OnUsageError: usageErrorHandler, } ) diff --git a/cmd/podman/pod_create.go b/cmd/podman/pod_create.go index 3e712619e..262a024d0 100644 --- a/cmd/podman/pod_create.go +++ b/cmd/podman/pod_create.go @@ -74,6 +74,7 @@ var podCreateCommand = cli.Command{ HideHelp: true, SkipArgReorder: true, UseShortOptionHandling: true, + OnUsageError: usageErrorHandler, } func podCreateCmd(c *cli.Context) error { diff --git a/cmd/podman/pod_inspect.go b/cmd/podman/pod_inspect.go index 1370c9471..34208336b 100644 --- a/cmd/podman/pod_inspect.go +++ b/cmd/podman/pod_inspect.go @@ -23,6 +23,7 @@ var ( Action: podInspectCmd, UseShortOptionHandling: true, ArgsUsage: "[POD_NAME_OR_ID]", + OnUsageError: usageErrorHandler, } ) diff --git a/cmd/podman/pod_kill.go b/cmd/podman/pod_kill.go index 3cd9bf7c9..11a3a9207 100644 --- a/cmd/podman/pod_kill.go +++ b/cmd/podman/pod_kill.go @@ -33,6 +33,7 @@ var ( Action: podKillCmd, ArgsUsage: "[POD_NAME_OR_ID]", UseShortOptionHandling: true, + OnUsageError: usageErrorHandler, } ) diff --git a/cmd/podman/pod_pause.go b/cmd/podman/pod_pause.go index 0e2e797f5..9eb80cddf 100644 --- a/cmd/podman/pod_pause.go +++ b/cmd/podman/pod_pause.go @@ -29,6 +29,7 @@ var ( Action: podPauseCmd, ArgsUsage: "POD-NAME|POD-ID [POD-NAME|POD-ID ...]", UseShortOptionHandling: true, + OnUsageError: usageErrorHandler, } ) diff --git a/cmd/podman/pod_ps.go b/cmd/podman/pod_ps.go index 31830a01b..8fea3f588 100644 --- a/cmd/podman/pod_ps.go +++ b/cmd/podman/pod_ps.go @@ -164,6 +164,7 @@ var ( Flags: podPsFlags, Action: podPsCmd, UseShortOptionHandling: true, + OnUsageError: usageErrorHandler, } ) diff --git a/cmd/podman/pod_restart.go b/cmd/podman/pod_restart.go index 62e93b316..b4a7f9e10 100644 --- a/cmd/podman/pod_restart.go +++ b/cmd/podman/pod_restart.go @@ -27,6 +27,7 @@ var ( Action: podRestartCmd, ArgsUsage: "POD-NAME|POD-ID [POD-NAME|POD-ID ...]", UseShortOptionHandling: true, + OnUsageError: usageErrorHandler, } ) diff --git a/cmd/podman/pod_rm.go b/cmd/podman/pod_rm.go index 549fa0290..09eb9b394 100644 --- a/cmd/podman/pod_rm.go +++ b/cmd/podman/pod_rm.go @@ -34,6 +34,7 @@ If --force is specified, all containers will be stopped, then removed. Action: podRmCmd, ArgsUsage: "[POD ...]", UseShortOptionHandling: true, + OnUsageError: usageErrorHandler, } ) diff --git a/cmd/podman/pod_start.go b/cmd/podman/pod_start.go index b6ba5719b..4735028e0 100644 --- a/cmd/podman/pod_start.go +++ b/cmd/podman/pod_start.go @@ -31,6 +31,7 @@ var ( Action: podStartCmd, ArgsUsage: "POD-NAME [POD-NAME ...]", UseShortOptionHandling: true, + OnUsageError: usageErrorHandler, } ) diff --git a/cmd/podman/pod_stats.go b/cmd/podman/pod_stats.go index ae371da6f..0a3c6942b 100644 --- a/cmd/podman/pod_stats.go +++ b/cmd/podman/pod_stats.go @@ -43,6 +43,7 @@ var ( Action: podStatsCmd, ArgsUsage: "[POD_NAME_OR_ID]", UseShortOptionHandling: true, + OnUsageError: usageErrorHandler, } ) diff --git a/cmd/podman/pod_stop.go b/cmd/podman/pod_stop.go index ac6781408..03d04a3ec 100644 --- a/cmd/podman/pod_stop.go +++ b/cmd/podman/pod_stop.go @@ -24,12 +24,13 @@ var ( ` podStopCommand = cli.Command{ - Name: "stop", - Usage: "Stop one or more pods", - Description: podStopDescription, - Flags: podStopFlags, - Action: podStopCmd, - ArgsUsage: "POD-NAME [POD-NAME ...]", + Name: "stop", + Usage: "Stop one or more pods", + Description: podStopDescription, + Flags: podStopFlags, + Action: podStopCmd, + ArgsUsage: "POD-NAME [POD-NAME ...]", + OnUsageError: usageErrorHandler, } ) diff --git a/cmd/podman/pod_top.go b/cmd/podman/pod_top.go index 703ec0a44..fe351c707 100644 --- a/cmd/podman/pod_top.go +++ b/cmd/podman/pod_top.go @@ -36,6 +36,7 @@ the latest pod. Action: podTopCmd, ArgsUsage: "POD-NAME [format descriptors]", SkipArgReorder: true, + OnUsageError: usageErrorHandler, } ) diff --git a/cmd/podman/pod_unpause.go b/cmd/podman/pod_unpause.go index d599baba9..cdee3cbe7 100644 --- a/cmd/podman/pod_unpause.go +++ b/cmd/podman/pod_unpause.go @@ -29,6 +29,7 @@ var ( Action: podUnpauseCmd, ArgsUsage: "POD-NAME|POD-ID [POD-NAME|POD-ID ...]", UseShortOptionHandling: true, + OnUsageError: usageErrorHandler, } ) diff --git a/cmd/podman/port.go b/cmd/podman/port.go index e3933f925..b7c88887a 100644 --- a/cmd/podman/port.go +++ b/cmd/podman/port.go @@ -26,12 +26,13 @@ var ( ` portCommand = cli.Command{ - Name: "port", - Usage: "List port mappings or a specific mapping for the container", - Description: portDescription, - Flags: portFlags, - Action: portCmd, - ArgsUsage: "CONTAINER-NAME [mapping]", + Name: "port", + Usage: "List port mappings or a specific mapping for the container", + Description: portDescription, + Flags: portFlags, + Action: portCmd, + ArgsUsage: "CONTAINER-NAME [mapping]", + OnUsageError: usageErrorHandler, } ) diff --git a/cmd/podman/ps.go b/cmd/podman/ps.go index 0b59b24b7..07e3bb676 100644 --- a/cmd/podman/ps.go +++ b/cmd/podman/ps.go @@ -186,6 +186,7 @@ var ( Action: psCmd, ArgsUsage: "", UseShortOptionHandling: true, + OnUsageError: usageErrorHandler, } lsCommand = cli.Command{ Name: "ls", @@ -195,6 +196,7 @@ var ( Action: psCmd, ArgsUsage: "", UseShortOptionHandling: true, + OnUsageError: usageErrorHandler, } ) diff --git a/cmd/podman/pull.go b/cmd/podman/pull.go index f1666113b..902bd867c 100644 --- a/cmd/podman/pull.go +++ b/cmd/podman/pull.go @@ -51,12 +51,13 @@ An image can be pulled using its tag or digest. If a tag is not specified, the image with the 'latest' tag (if it exists) is pulled ` pullCommand = cli.Command{ - Name: "pull", - Usage: "Pull an image from a registry", - Description: pullDescription, - Flags: pullFlags, - Action: pullCmd, - ArgsUsage: "", + Name: "pull", + Usage: "Pull an image from a registry", + Description: pullDescription, + Flags: pullFlags, + Action: pullCmd, + ArgsUsage: "", + OnUsageError: usageErrorHandler, } ) diff --git a/cmd/podman/push.go b/cmd/podman/push.go index 79758257a..d9aa2246b 100644 --- a/cmd/podman/push.go +++ b/cmd/podman/push.go @@ -67,12 +67,13 @@ var ( See podman-push(1) section "DESTINATION" for the expected format`) pushCommand = cli.Command{ - Name: "push", - Usage: "Push an image to a specified destination", - Description: pushDescription, - Flags: pushFlags, - Action: pushCmd, - ArgsUsage: "IMAGE DESTINATION", + Name: "push", + Usage: "Push an image to a specified destination", + Description: pushDescription, + Flags: pushFlags, + Action: pushCmd, + ArgsUsage: "IMAGE DESTINATION", + OnUsageError: usageErrorHandler, } ) diff --git a/cmd/podman/refresh.go b/cmd/podman/refresh.go index 8e4fd9ae9..df16ad5f0 100644 --- a/cmd/podman/refresh.go +++ b/cmd/podman/refresh.go @@ -21,6 +21,7 @@ var ( Flags: refreshFlags, Action: refreshCmd, UseShortOptionHandling: true, + OnUsageError: usageErrorHandler, } ) diff --git a/cmd/podman/restart.go b/cmd/podman/restart.go index 89484f895..d2d0c0fd7 100644 --- a/cmd/podman/restart.go +++ b/cmd/podman/restart.go @@ -30,6 +30,7 @@ var ( Action: restartCmd, ArgsUsage: "CONTAINER [CONTAINER ...]", UseShortOptionHandling: true, + OnUsageError: usageErrorHandler, } ) diff --git a/cmd/podman/rm.go b/cmd/podman/rm.go index 1d580ac7e..eb9f1b170 100644 --- a/cmd/podman/rm.go +++ b/cmd/podman/rm.go @@ -35,6 +35,7 @@ Running containers will not be removed without the -f option. Action: rmCmd, ArgsUsage: "", UseShortOptionHandling: true, + OnUsageError: usageErrorHandler, } ) diff --git a/cmd/podman/rmi.go b/cmd/podman/rmi.go index c1c3869c8..e29f32c7c 100644 --- a/cmd/podman/rmi.go +++ b/cmd/podman/rmi.go @@ -31,6 +31,7 @@ var ( ArgsUsage: "IMAGE-NAME-OR-ID [...]", Flags: rmiFlags, UseShortOptionHandling: true, + OnUsageError: usageErrorHandler, } rmImageCommand = cli.Command{ Name: "rm", @@ -40,6 +41,7 @@ var ( ArgsUsage: "IMAGE-NAME-OR-ID [...]", Flags: rmiFlags, UseShortOptionHandling: true, + OnUsageError: usageErrorHandler, } ) diff --git a/cmd/podman/run.go b/cmd/podman/run.go index a6d0526ff..66e78dafd 100644 --- a/cmd/podman/run.go +++ b/cmd/podman/run.go @@ -37,6 +37,7 @@ var runCommand = cli.Command{ HideHelp: true, SkipArgReorder: true, UseShortOptionHandling: true, + OnUsageError: usageErrorHandler, } func runCmd(c *cli.Context) error { diff --git a/cmd/podman/save.go b/cmd/podman/save.go index 8186718d4..a1e980f34 100644 --- a/cmd/podman/save.go +++ b/cmd/podman/save.go @@ -57,6 +57,7 @@ var ( Action: saveCmd, ArgsUsage: "", SkipArgReorder: true, + OnUsageError: usageErrorHandler, } ) diff --git a/cmd/podman/search.go b/cmd/podman/search.go index 2e68e8c21..009ff8ba9 100644 --- a/cmd/podman/search.go +++ b/cmd/podman/search.go @@ -52,12 +52,13 @@ var ( Search registries for a given image. Can search all the default registries or a specific registry. Can limit the number of results, and filter the output based on certain conditions.` searchCommand = cli.Command{ - Name: "search", - Usage: "Search registry for image", - Description: searchDescription, - Flags: searchFlags, - Action: searchCmd, - ArgsUsage: "TERM", + Name: "search", + Usage: "Search registry for image", + Description: searchDescription, + Flags: searchFlags, + Action: searchCmd, + ArgsUsage: "TERM", + OnUsageError: usageErrorHandler, } ) diff --git a/cmd/podman/start.go b/cmd/podman/start.go index f0f205892..cb65ec6d4 100644 --- a/cmd/podman/start.go +++ b/cmd/podman/start.go @@ -45,6 +45,7 @@ var ( Action: startCmd, ArgsUsage: "CONTAINER-NAME [CONTAINER-NAME ...]", UseShortOptionHandling: true, + OnUsageError: usageErrorHandler, } ) diff --git a/cmd/podman/stats.go b/cmd/podman/stats.go index 2d6a2a3d2..181f5376c 100644 --- a/cmd/podman/stats.go +++ b/cmd/podman/stats.go @@ -49,12 +49,13 @@ var ( statsDescription = "display a live stream of one or more containers' resource usage statistics" statsCommand = cli.Command{ - Name: "stats", - Usage: "Display percentage of CPU, memory, network I/O, block I/O and PIDs for one or more containers", - Description: statsDescription, - Flags: statsFlags, - Action: statsCmd, - ArgsUsage: "", + Name: "stats", + Usage: "Display percentage of CPU, memory, network I/O, block I/O and PIDs for one or more containers", + Description: statsDescription, + Flags: statsFlags, + Action: statsCmd, + ArgsUsage: "", + OnUsageError: usageErrorHandler, } ) diff --git a/cmd/podman/stop.go b/cmd/podman/stop.go index c8f03a748..d2fa87730 100644 --- a/cmd/podman/stop.go +++ b/cmd/podman/stop.go @@ -32,12 +32,13 @@ var ( ` stopCommand = cli.Command{ - Name: "stop", - Usage: "Stop one or more containers", - Description: stopDescription, - Flags: stopFlags, - Action: stopCmd, - ArgsUsage: "CONTAINER-NAME [CONTAINER-NAME ...]", + Name: "stop", + Usage: "Stop one or more containers", + Description: stopDescription, + Flags: stopFlags, + Action: stopCmd, + ArgsUsage: "CONTAINER-NAME [CONTAINER-NAME ...]", + OnUsageError: usageErrorHandler, } ) diff --git a/cmd/podman/tag.go b/cmd/podman/tag.go index 5c81fe7f8..29f66d41e 100644 --- a/cmd/podman/tag.go +++ b/cmd/podman/tag.go @@ -9,11 +9,12 @@ import ( var ( tagDescription = "Adds one or more additional names to locally-stored image" tagCommand = cli.Command{ - Name: "tag", - Usage: "Add an additional name to a local image", - Description: tagDescription, - Action: tagCmd, - ArgsUsage: "IMAGE-NAME [IMAGE-NAME ...]", + Name: "tag", + Usage: "Add an additional name to a local image", + Description: tagDescription, + Action: tagCmd, + ArgsUsage: "IMAGE-NAME [IMAGE-NAME ...]", + OnUsageError: usageErrorHandler, } ) diff --git a/cmd/podman/top.go b/cmd/podman/top.go index 5517fe230..9b5c3afae 100644 --- a/cmd/podman/top.go +++ b/cmd/podman/top.go @@ -46,6 +46,7 @@ the latest container. Action: topCmd, ArgsUsage: "CONTAINER-NAME [format descriptors]", SkipArgReorder: true, + OnUsageError: usageErrorHandler, } ) diff --git a/cmd/podman/umount.go b/cmd/podman/umount.go index 33556b2ea..b6837fb5b 100644 --- a/cmd/podman/umount.go +++ b/cmd/podman/umount.go @@ -31,13 +31,14 @@ counter reaches zero indicating no other processes are using the mount. An unmount can be forced with the --force flag. ` umountCommand = cli.Command{ - Name: "umount", - Aliases: []string{"unmount"}, - Usage: "Unmounts working container's root filesystem", - Description: description, - Flags: umountFlags, - Action: umountCmd, - ArgsUsage: "CONTAINER-NAME-OR-ID", + Name: "umount", + Aliases: []string{"unmount"}, + Usage: "Unmounts working container's root filesystem", + Description: description, + Flags: umountFlags, + Action: umountCmd, + ArgsUsage: "CONTAINER-NAME-OR-ID", + OnUsageError: usageErrorHandler, } ) diff --git a/cmd/podman/unpause.go b/cmd/podman/unpause.go index d5b2732af..d4e2605cb 100644 --- a/cmd/podman/unpause.go +++ b/cmd/podman/unpause.go @@ -16,11 +16,12 @@ var ( Unpauses one or more running containers. The container name or ID can be used. ` unpauseCommand = cli.Command{ - Name: "unpause", - Usage: "Unpause the processes in one or more containers", - Description: unpauseDescription, - Action: unpauseCmd, - ArgsUsage: "CONTAINER-NAME [CONTAINER-NAME ...]", + Name: "unpause", + Usage: "Unpause the processes in one or more containers", + Description: unpauseDescription, + Action: unpauseCmd, + ArgsUsage: "CONTAINER-NAME [CONTAINER-NAME ...]", + OnUsageError: usageErrorHandler, } ) diff --git a/cmd/podman/varlink.go b/cmd/podman/varlink.go index e8f38cad2..2f92d9adb 100644 --- a/cmd/podman/varlink.go +++ b/cmd/podman/varlink.go @@ -29,12 +29,13 @@ var ( }, } varlinkCommand = &cli.Command{ - Name: "varlink", - Usage: "Run varlink interface", - Description: varlinkDescription, - Flags: varlinkFlags, - Action: varlinkCmd, - ArgsUsage: "VARLINK_URI", + Name: "varlink", + Usage: "Run varlink interface", + Description: varlinkDescription, + Flags: varlinkFlags, + Action: varlinkCmd, + ArgsUsage: "VARLINK_URI", + OnUsageError: usageErrorHandler, } ) diff --git a/cmd/podman/wait.go b/cmd/podman/wait.go index 929b66761..e919ab3ca 100644 --- a/cmd/podman/wait.go +++ b/cmd/podman/wait.go @@ -17,12 +17,13 @@ var ( ` waitFlags = []cli.Flag{LatestFlag} waitCommand = cli.Command{ - Name: "wait", - Usage: "Block on one or more containers", - Description: waitDescription, - Flags: waitFlags, - Action: waitCmd, - ArgsUsage: "CONTAINER-NAME [CONTAINER-NAME ...]", + Name: "wait", + Usage: "Block on one or more containers", + Description: waitDescription, + Flags: waitFlags, + Action: waitCmd, + ArgsUsage: "CONTAINER-NAME [CONTAINER-NAME ...]", + OnUsageError: usageErrorHandler, } ) |