diff options
author | Daniel J Walsh <dwalsh@redhat.com> | 2019-02-11 19:19:19 -0700 |
---|---|---|
committer | Daniel J Walsh <dwalsh@redhat.com> | 2019-02-12 05:14:38 -0700 |
commit | ccbc4fb006253788910eba86eb6674d3465992c3 (patch) | |
tree | d906767a8c57215b97ccfe979fe4beb201b14f64 /cmd/podman | |
parent | ea20ead35b69b1259f2ff3b00f558c473a921b95 (diff) | |
download | podman-ccbc4fb006253788910eba86eb6674d3465992c3.tar.gz podman-ccbc4fb006253788910eba86eb6674d3465992c3.tar.bz2 podman-ccbc4fb006253788910eba86eb6674d3465992c3.zip |
Don't show global flags except for podman command
Subcommands should not be showing the global flags. This causes the important
information to scroll off the screen.
Also fixed a typo on runCommmand (Too many 'm's)
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'cmd/podman')
80 files changed, 122 insertions, 21 deletions
diff --git a/cmd/podman/attach.go b/cmd/podman/attach.go index ecba91a90..c29886825 100644 --- a/cmd/podman/attach.go +++ b/cmd/podman/attach.go @@ -28,6 +28,7 @@ var ( func init() { attachCommand.Command = _attachCommand + attachCommand.SetUsageTemplate(UsageTemplate()) flags := attachCommand.Flags() flags.StringVar(&attachCommand.DetachKeys, "detach-keys", "", "Override the key sequence for detaching a container. Format is a single character [a-Z] or ctrl-<value> where <value> is one of: a-z, @, ^, [, , or _") flags.BoolVar(&attachCommand.NoStdin, "no-stdin", false, "Do not attach STDIN. The default is false") diff --git a/cmd/podman/build.go b/cmd/podman/build.go index cebca18f1..fef93ac47 100644 --- a/cmd/podman/build.go +++ b/cmd/podman/build.go @@ -48,6 +48,7 @@ var ( func init() { buildCommand.Command = _buildCommand + buildCommand.SetUsageTemplate(UsageTemplate()) flags := buildCommand.Flags() flags.SetInterspersed(false) diff --git a/cmd/podman/checkpoint.go b/cmd/podman/checkpoint.go index 2a978bea8..aa4034ccd 100644 --- a/cmd/podman/checkpoint.go +++ b/cmd/podman/checkpoint.go @@ -35,6 +35,7 @@ var ( func init() { checkpointCommand.Command = _checkpointCommand + checkpointCommand.SetUsageTemplate(UsageTemplate()) flags := checkpointCommand.Flags() flags.BoolVarP(&checkpointCommand.Keep, "keep", "k", false, "Keep all temporary checkpoint files") diff --git a/cmd/podman/cleanup.go b/cmd/podman/cleanup.go index 1a7617d5c..b1f727d33 100644 --- a/cmd/podman/cleanup.go +++ b/cmd/podman/cleanup.go @@ -32,6 +32,7 @@ var ( func init() { cleanupCommand.Command = _cleanupCommand + cleanupCommand.SetUsageTemplate(UsageTemplate()) flags := cleanupCommand.Flags() flags.BoolVarP(&cleanupCommand.All, "all", "a", false, "Cleans up all containers") diff --git a/cmd/podman/commands.go b/cmd/podman/commands.go index fd438e2fc..2c56d5dec 100644 --- a/cmd/podman/commands.go +++ b/cmd/podman/commands.go @@ -32,7 +32,7 @@ func getMainCommands() []*cobra.Command { _restartCommand, _restoreCommand, _rmCommand, - _runCommmand, + _runCommand, _saveCommand, _searchCommand, _signCommand, @@ -82,7 +82,7 @@ func getContainerSubCommands() []*cobra.Command { _restartCommand, _restoreCommand, _rmCommand, - _runCommmand, + _runCommand, _runlabelCommand, _startCommand, _statsCommand, diff --git a/cmd/podman/commit.go b/cmd/podman/commit.go index e77903c36..dc53e68d1 100644 --- a/cmd/podman/commit.go +++ b/cmd/podman/commit.go @@ -39,6 +39,7 @@ var ( func init() { commitCommand.Command = _commitCommand + commitCommand.SetUsageTemplate(UsageTemplate()) flags := commitCommand.Flags() flags.StringSliceVarP(&commitCommand.Change, "change", "c", []string{}, fmt.Sprintf("Apply the following possible instructions to the created image (default []): %s", strings.Join(libpod.ChangeCmds, " | "))) flags.StringVarP(&commitCommand.Format, "format", "f", "oci", "`Format` of the image manifest and metadata") diff --git a/cmd/podman/common.go b/cmd/podman/common.go index 5fbdfce50..417e938b7 100644 --- a/cmd/podman/common.go +++ b/cmd/podman/common.go @@ -500,3 +500,27 @@ func scrubServer(server string) string { server = strings.TrimPrefix(server, "https://") return strings.TrimPrefix(server, "http://") } + +// UsageTemplate returns the usage template for podman commands +// This blocks the desplaying of the global options. The main podman +// command should not use this. +func UsageTemplate() string { + return `Usage:{{if .Runnable}} + {{.UseLine}}{{end}}{{if .HasAvailableSubCommands}} + + {{.CommandPath}} [command]{{end}}{{if gt (len .Aliases) 0}} + +Aliases: + {{.NameAndAliases}}{{end}}{{if .HasExample}} + +Examples: +{{.Example}}{{end}}{{if .HasAvailableSubCommands}} + +Available Commands:{{range .Commands}}{{if (or .IsAvailableCommand (eq .Name "help"))}} + {{rpad .Name .NamePadding }} {{.Short}}{{end}}{{end}}{{end}}{{if .HasAvailableLocalFlags}} + +Flags: +{{.LocalFlags.FlagUsages | trimTrailingWhitespaces}}{{end}}{{if .HasAvailableInheritedFlags}} +{{end}} +` +} diff --git a/cmd/podman/container.go b/cmd/podman/container.go index 6d9231482..d2450fdd3 100644 --- a/cmd/podman/container.go +++ b/cmd/podman/container.go @@ -23,5 +23,6 @@ var containerCommands = []*cobra.Command{ func init() { containerCommand.AddCommand(containerCommands...) containerCommand.AddCommand(getContainerSubCommands()...) + containerCommand.SetUsageTemplate(UsageTemplate()) rootCmd.AddCommand(containerCommand.Command) } diff --git a/cmd/podman/containers_prune.go b/cmd/podman/containers_prune.go index 3f9b46035..acc138fe0 100644 --- a/cmd/podman/containers_prune.go +++ b/cmd/podman/containers_prune.go @@ -34,6 +34,7 @@ var ( func init() { pruneContainersCommand.Command = _pruneContainersCommand + pruneContainersCommand.SetUsageTemplate(UsageTemplate()) } func pruneContainers(runtime *adapter.LocalRuntime, ctx context.Context, maxWorkers int, force bool) error { diff --git a/cmd/podman/create.go b/cmd/podman/create.go index 7aa371147..1a7f419c0 100644 --- a/cmd/podman/create.go +++ b/cmd/podman/create.go @@ -60,6 +60,7 @@ var ( func init() { createCommand.PodmanCommand.Command = _createCommand + createCommand.SetUsageTemplate(UsageTemplate()) getCreateFlags(&createCommand.PodmanCommand) flags := createCommand.Flags() diff --git a/cmd/podman/diff.go b/cmd/podman/diff.go index 1bcedbd1e..7d4cc1b58 100644 --- a/cmd/podman/diff.go +++ b/cmd/podman/diff.go @@ -52,6 +52,7 @@ var ( func init() { diffCommand.Command = _diffCommand + diffCommand.SetUsageTemplate(UsageTemplate()) flags := diffCommand.Flags() flags.BoolVar(&diffCommand.Archive, "archive", true, "Save the diff as a tar archive") diff --git a/cmd/podman/exec.go b/cmd/podman/exec.go index fa6e4af03..74808768e 100644 --- a/cmd/podman/exec.go +++ b/cmd/podman/exec.go @@ -35,6 +35,7 @@ var ( func init() { execCommand.Command = _execCommand + execCommand.SetUsageTemplate(UsageTemplate()) flags := execCommand.Flags() flags.SetInterspersed(false) flags.StringSliceVarP(&execCommand.Env, "env", "e", []string{}, "Set environment variables") diff --git a/cmd/podman/exists.go b/cmd/podman/exists.go index a21e8fcf8..15ddaec06 100644 --- a/cmd/podman/exists.go +++ b/cmd/podman/exists.go @@ -72,8 +72,11 @@ var ( func init() { imageExistsCommand.Command = _imageExistsCommand + imageExistsCommand.SetUsageTemplate(UsageTemplate()) containerExistsCommand.Command = _containerExistsCommand + containerExistsCommand.SetUsageTemplate(UsageTemplate()) podExistsCommand.Command = _podExistsCommand + podExistsCommand.SetUsageTemplate(UsageTemplate()) } func imageExistsCmd(c *cliconfig.ImageExistsValues) error { diff --git a/cmd/podman/export.go b/cmd/podman/export.go index 18fcc679c..2ce8186a1 100644 --- a/cmd/podman/export.go +++ b/cmd/podman/export.go @@ -31,6 +31,7 @@ var ( func init() { exportCommand.Command = _exportCommand + exportCommand.SetUsageTemplate(UsageTemplate()) flags := exportCommand.Flags() flags.StringVarP(&exportCommand.Output, "output", "o", "/dev/stdout", "Write to a file, default is STDOUT") } diff --git a/cmd/podman/generate.go b/cmd/podman/generate.go index d258c5194..66cb7a465 100644 --- a/cmd/podman/generate.go +++ b/cmd/podman/generate.go @@ -17,4 +17,5 @@ var generateCommand = cliconfig.PodmanCommand{ func init() { generateCommand.AddCommand(getGenerateSubCommands()...) + generateCommand.SetUsageTemplate(UsageTemplate()) } diff --git a/cmd/podman/generate_kube.go b/cmd/podman/generate_kube.go index 8e3432d12..ddb2daa34 100644 --- a/cmd/podman/generate_kube.go +++ b/cmd/podman/generate_kube.go @@ -31,6 +31,7 @@ var ( func init() { containerKubeCommand.Command = _containerKubeCommand + containerKubeCommand.SetUsageTemplate(UsageTemplate()) flags := containerKubeCommand.Flags() flags.BoolVarP(&containerKubeCommand.Service, "service", "s", false, "Generate YAML for kubernetes service object") } diff --git a/cmd/podman/history.go b/cmd/podman/history.go index 953c94b69..6791257d9 100644 --- a/cmd/podman/history.go +++ b/cmd/podman/history.go @@ -53,6 +53,7 @@ var ( func init() { historyCommand.Command = _historyCommand + historyCommand.SetUsageTemplate(UsageTemplate()) flags := historyCommand.Flags() flags.StringVar(&historyCommand.Format, "format", "", "Change the output to JSON or a Go template") flags.BoolVarP(&historyCommand.Human, "human", "H", true, "Display sizes and dates in human readable format") diff --git a/cmd/podman/image.go b/cmd/podman/image.go index e93c63267..74e28eeca 100644 --- a/cmd/podman/image.go +++ b/cmd/podman/image.go @@ -30,6 +30,7 @@ var imageSubCommands = []*cobra.Command{ } func init() { + imageCommand.SetUsageTemplate(UsageTemplate()) imageCommand.AddCommand(imageSubCommands...) imageCommand.AddCommand(getImageSubCommands()...) } diff --git a/cmd/podman/images.go b/cmd/podman/images.go index 329b8e8d9..a9e8abbde 100644 --- a/cmd/podman/images.go +++ b/cmd/podman/images.go @@ -102,6 +102,7 @@ var ( func init() { imagesCommand.Command = _imagesCommand + imagesCommand.SetUsageTemplate(UsageTemplate()) flags := imagesCommand.Flags() flags.BoolVarP(&imagesCommand.All, "all", "a", false, "Show all images (default hides intermediate images)") flags.BoolVar(&imagesCommand.Digests, "digests", false, "Show digests") diff --git a/cmd/podman/images_prune.go b/cmd/podman/images_prune.go index ba99c5bde..cc0dcb99a 100644 --- a/cmd/podman/images_prune.go +++ b/cmd/podman/images_prune.go @@ -30,6 +30,7 @@ var ( func init() { pruneImagesCommand.Command = _pruneImagesCommand + pruneImagesCommand.SetUsageTemplate(UsageTemplate()) flags := pruneImagesCommand.Flags() flags.BoolVarP(&pruneImagesCommand.All, "all", "a", false, "Remove all unused images, not just dangling ones") } diff --git a/cmd/podman/import.go b/cmd/podman/import.go index 15b33f818..32f79757b 100644 --- a/cmd/podman/import.go +++ b/cmd/podman/import.go @@ -31,6 +31,7 @@ var ( func init() { importCommand.Command = _importCommand + importCommand.SetUsageTemplate(UsageTemplate()) flags := importCommand.Flags() flags.StringSliceVarP(&importCommand.Change, "change", "c", []string{}, "Apply the following possible instructions to the created image (default []): CMD | ENTRYPOINT | ENV | EXPOSE | LABEL | STOPSIGNAL | USER | VOLUME | WORKDIR") flags.StringVarP(&importCommand.Message, "message", "m", "", "Set commit message for imported image") diff --git a/cmd/podman/info.go b/cmd/podman/info.go index 177878e5a..d60b8f84f 100644 --- a/cmd/podman/info.go +++ b/cmd/podman/info.go @@ -32,6 +32,7 @@ var ( func init() { infoCommand.Command = _infoCommand + infoCommand.SetUsageTemplate(UsageTemplate()) flags := infoCommand.Flags() flags.BoolVarP(&infoCommand.Debug, "debug", "D", false, "Display additional debug information") diff --git a/cmd/podman/inspect.go b/cmd/podman/inspect.go index 21ad067cd..a29eb790e 100644 --- a/cmd/podman/inspect.go +++ b/cmd/podman/inspect.go @@ -40,6 +40,7 @@ var ( func init() { inspectCommand.Command = _inspectCommand + inspectCommand.SetUsageTemplate(UsageTemplate()) flags := inspectCommand.Flags() flags.StringVarP(&inspectCommand.TypeObject, "type", "t", inspectAll, "Return JSON for specified type, (e.g image, container or task)") flags.StringVarP(&inspectCommand.Format, "format", "f", "", "Change the output format to a Go template") diff --git a/cmd/podman/kill.go b/cmd/podman/kill.go index 75ebbb6b0..d922cf721 100644 --- a/cmd/podman/kill.go +++ b/cmd/podman/kill.go @@ -34,6 +34,7 @@ var ( func init() { killCommand.Command = _killCommand + killCommand.SetUsageTemplate(UsageTemplate()) flags := killCommand.Flags() flags.BoolVarP(&killCommand.All, "all", "a", false, "Signal all running containers") diff --git a/cmd/podman/load.go b/cmd/podman/load.go index c50cd1608..34a51cd0d 100644 --- a/cmd/podman/load.go +++ b/cmd/podman/load.go @@ -34,6 +34,7 @@ var ( func init() { loadCommand.Command = _loadCommand + loadCommand.SetUsageTemplate(UsageTemplate()) flags := loadCommand.Flags() flags.StringVarP(&loadCommand.Input, "input", "i", "/dev/stdin", "Read from archive file, default is STDIN") flags.BoolVarP(&loadCommand.Quiet, "quiet", "q", false, "Suppress the output") diff --git a/cmd/podman/login.go b/cmd/podman/login.go index 92102e940..0bd58ff78 100644 --- a/cmd/podman/login.go +++ b/cmd/podman/login.go @@ -35,6 +35,7 @@ var ( func init() { loginCommand.Command = _loginCommand + loginCommand.SetUsageTemplate(UsageTemplate()) flags := loginCommand.Flags() flags.StringVar(&loginCommand.Authfile, "authfile", "", "Path of the authentication file. Default is ${XDG_RUNTIME_DIR}/containers/auth.json. Use REGISTRY_AUTH_FILE environment variable to override") diff --git a/cmd/podman/logout.go b/cmd/podman/logout.go index 4d0f156e4..5fecf814e 100644 --- a/cmd/podman/logout.go +++ b/cmd/podman/logout.go @@ -28,6 +28,7 @@ var ( func init() { logoutCommand.Command = _logoutCommand + logoutCommand.SetUsageTemplate(UsageTemplate()) flags := logoutCommand.Flags() flags.BoolVarP(&logoutCommand.All, "all", "a", false, "Remove the cached credentials for all registries in the auth file") flags.StringVar(&logoutCommand.Authfile, "authfile", "", "Path of the authentication file. Default is ${XDG_RUNTIME_DIR}/containers/auth.json. Use REGISTRY_AUTH_FILE environment variable to override") diff --git a/cmd/podman/logs.go b/cmd/podman/logs.go index 77c0b17f3..6962a1f6d 100644 --- a/cmd/podman/logs.go +++ b/cmd/podman/logs.go @@ -32,6 +32,7 @@ var ( func init() { logsCommand.Command = _logsCommand + logsCommand.SetUsageTemplate(UsageTemplate()) flags := logsCommand.Flags() flags.BoolVar(&logsCommand.Details, "details", false, "Show extra details provided to the logs") flags.BoolVarP(&logsCommand.Follow, "follow", "f", false, "Follow log output. The default is false") diff --git a/cmd/podman/main.go b/cmd/podman/main.go index 49acde1f9..3facc146c 100644 --- a/cmd/podman/main.go +++ b/cmd/podman/main.go @@ -58,7 +58,7 @@ var cmdsNotRequiringRootless = map[*cobra.Command]bool{ _killCommand: true, _pauseCommand: true, _restartCommand: true, - _runCommmand: true, + _runCommand: true, _unpauseCommand: true, _searchCommand: true, _statsCommand: true, @@ -205,7 +205,7 @@ func main() { exitCode = status.ExitStatus() } } - fmt.Fprintln(os.Stderr, err.Error()) + fmt.Fprintln(os.Stderr, "Error:", err.Error()) } } else { // The exitCode modified from 125, indicates an application diff --git a/cmd/podman/mount.go b/cmd/podman/mount.go index d16b17108..ce7c22d60 100644 --- a/cmd/podman/mount.go +++ b/cmd/podman/mount.go @@ -39,6 +39,7 @@ var ( func init() { mountCommand.Command = _mountCommand + mountCommand.SetUsageTemplate(UsageTemplate()) flags := mountCommand.Flags() flags.BoolVarP(&mountCommand.All, "all", "a", false, "Mount all containers") flags.StringVar(&mountCommand.Format, "format", "", "Change the output format to Go template") diff --git a/cmd/podman/pause.go b/cmd/podman/pause.go index 8d8501ff7..a840cbe49 100644 --- a/cmd/podman/pause.go +++ b/cmd/podman/pause.go @@ -34,6 +34,7 @@ var ( func init() { pauseCommand.Command = _pauseCommand + pauseCommand.SetUsageTemplate(UsageTemplate()) flags := pauseCommand.Flags() flags.BoolVarP(&pauseCommand.All, "all", "a", false, "Pause all running containers") diff --git a/cmd/podman/play.go b/cmd/podman/play.go index f083c9ff1..495a1f170 100644 --- a/cmd/podman/play.go +++ b/cmd/podman/play.go @@ -5,18 +5,18 @@ import ( "github.com/spf13/cobra" ) -var playCommand cliconfig.PodmanCommand - -func init() { - var playDescription = "Play a pod and its containers from a structured file." - playCommand.Command = &cobra.Command{ +var ( + playCommand cliconfig.PodmanCommand + playDescription = "Play a pod and its containers from a structured file." + _playCommand = &cobra.Command{ Use: "play", Short: "Play a pod", Long: playDescription, } - -} +) func init() { + playCommand.Command = _playCommand + playCommand.SetUsageTemplate(UsageTemplate()) playCommand.AddCommand(getPlaySubCommands()...) } diff --git a/cmd/podman/play_kube.go b/cmd/podman/play_kube.go index b314c1278..4ecd30cd4 100644 --- a/cmd/podman/play_kube.go +++ b/cmd/podman/play_kube.go @@ -43,6 +43,7 @@ var ( func init() { playKubeCommand.Command = _playKubeCommand + playKubeCommand.SetUsageTemplate(UsageTemplate()) flags := playKubeCommand.Flags() flags.StringVar(&playKubeCommand.Authfile, "authfile", "", "Path of the authentication file. Default is ${XDG_RUNTIME_DIR}/containers/auth.json. Use REGISTRY_AUTH_FILE environment variable to override") flags.StringVar(&playKubeCommand.CertDir, "cert-dir", "", "`Pathname` of a directory containing TLS certificates and keys") diff --git a/cmd/podman/pod.go b/cmd/podman/pod.go index 4de824703..e988875ab 100644 --- a/cmd/podman/pod.go +++ b/cmd/podman/pod.go @@ -20,4 +20,5 @@ var podCommand = cliconfig.PodmanCommand{ func init() { podCommand.AddCommand(getPodSubCommands()...) + podCommand.SetUsageTemplate(UsageTemplate()) } diff --git a/cmd/podman/pod_create.go b/cmd/podman/pod_create.go index 35e58df31..0a0b86aab 100644 --- a/cmd/podman/pod_create.go +++ b/cmd/podman/pod_create.go @@ -38,6 +38,7 @@ var ( func init() { podCreateCommand.Command = _podCreateCommand + podCreateCommand.SetUsageTemplate(UsageTemplate()) flags := podCreateCommand.Flags() flags.SetInterspersed(false) diff --git a/cmd/podman/pod_inspect.go b/cmd/podman/pod_inspect.go index f4c357e96..a0b691642 100644 --- a/cmd/podman/pod_inspect.go +++ b/cmd/podman/pod_inspect.go @@ -29,6 +29,7 @@ var ( func init() { podInspectCommand.Command = _podInspectCommand + podInspectCommand.SetUsageTemplate(UsageTemplate()) flags := podInspectCommand.Flags() flags.BoolVarP(&podInspectCommand.Latest, "latest", "l", false, "Act on the latest container podman is aware of") diff --git a/cmd/podman/pod_kill.go b/cmd/podman/pod_kill.go index 43411a988..febc820cd 100644 --- a/cmd/podman/pod_kill.go +++ b/cmd/podman/pod_kill.go @@ -30,6 +30,7 @@ var ( func init() { podKillCommand.Command = _podKillCommand + podKillCommand.SetUsageTemplate(UsageTemplate()) flags := podKillCommand.Flags() flags.BoolVarP(&podKillCommand.All, "all", "a", false, "Kill all containers in all pods") flags.BoolVarP(&podKillCommand.Latest, "latest", "l", false, "Act on the latest pod podman is aware of") diff --git a/cmd/podman/pod_pause.go b/cmd/podman/pod_pause.go index a54783d88..2059727ae 100644 --- a/cmd/podman/pod_pause.go +++ b/cmd/podman/pod_pause.go @@ -27,6 +27,7 @@ var ( func init() { podPauseCommand.Command = _podPauseCommand + podPauseCommand.SetUsageTemplate(UsageTemplate()) flags := podPauseCommand.Flags() flags.BoolVarP(&podPauseCommand.All, "all", "a", false, "Pause all running pods") flags.BoolVarP(&podPauseCommand.Latest, "latest", "l", false, "Act on the latest pod podman is aware of") diff --git a/cmd/podman/pod_ps.go b/cmd/podman/pod_ps.go index 991e294bf..49af91a1e 100644 --- a/cmd/podman/pod_ps.go +++ b/cmd/podman/pod_ps.go @@ -131,6 +131,7 @@ var ( func init() { podPsCommand.Command = _podPsCommand + podPsCommand.SetUsageTemplate(UsageTemplate()) flags := podPsCommand.Flags() flags.BoolVar(&podPsCommand.CtrNames, "ctr-names", false, "Display the container names") flags.BoolVar(&podPsCommand.CtrIDs, "ctr-ids", false, "Display the container UUIDs. If no-trunc is not set they will be truncated") diff --git a/cmd/podman/pod_restart.go b/cmd/podman/pod_restart.go index 4d05205ea..f75d84956 100644 --- a/cmd/podman/pod_restart.go +++ b/cmd/podman/pod_restart.go @@ -28,6 +28,7 @@ var ( func init() { podRestartCommand.Command = _podRestartCommand + podRestartCommand.SetUsageTemplate(UsageTemplate()) flags := podRestartCommand.Flags() flags.BoolVarP(&podRestartCommand.All, "all", "a", false, "Restart all running pods") flags.BoolVarP(&podRestartCommand.Latest, "latest", "l", false, "Restart the latest pod podman is aware of") diff --git a/cmd/podman/pod_rm.go b/cmd/podman/pod_rm.go index 445a641df..389f44a20 100644 --- a/cmd/podman/pod_rm.go +++ b/cmd/podman/pod_rm.go @@ -32,6 +32,7 @@ If --force is specified, all containers will be stopped, then removed. func init() { podRmCommand.Command = _podRmCommand + podRmCommand.SetUsageTemplate(UsageTemplate()) flags := podRmCommand.Flags() flags.BoolVarP(&podRmCommand.All, "all", "a", false, "Remove all running pods") flags.BoolVarP(&podRmCommand.Force, "force", "f", false, "Force removal of a running pod by first stopping all containers, then removing all containers in the pod. The default is false") diff --git a/cmd/podman/pod_start.go b/cmd/podman/pod_start.go index 8b35d3e04..829fe2107 100644 --- a/cmd/podman/pod_start.go +++ b/cmd/podman/pod_start.go @@ -32,6 +32,7 @@ var ( func init() { podStartCommand.Command = _podStartCommand + podStartCommand.SetUsageTemplate(UsageTemplate()) flags := podStartCommand.Flags() flags.BoolVarP(&podStartCommand.All, "all", "a", false, "Start all pods") flags.BoolVarP(&podStartCommand.Latest, "latest", "l", false, "Start the latest pod podman is aware of") diff --git a/cmd/podman/pod_stats.go b/cmd/podman/pod_stats.go index 02dee68ac..7afab6be9 100644 --- a/cmd/podman/pod_stats.go +++ b/cmd/podman/pod_stats.go @@ -38,6 +38,7 @@ var ( func init() { podStatsCommand.Command = _podStatsCommand + podStatsCommand.SetUsageTemplate(UsageTemplate()) flags := podStatsCommand.Flags() flags.BoolVarP(&podStatsCommand.All, "all", "a", false, "Provide stats for all running pods") flags.StringVar(&podStatsCommand.Format, "format", "", "Pretty-print container statistics to JSON or using a Go template") diff --git a/cmd/podman/pod_stop.go b/cmd/podman/pod_stop.go index 63bd0f5cb..80082045d 100644 --- a/cmd/podman/pod_stop.go +++ b/cmd/podman/pod_stop.go @@ -33,6 +33,7 @@ var ( func init() { podStopCommand.Command = _podStopCommand + podStopCommand.SetUsageTemplate(UsageTemplate()) flags := podStopCommand.Flags() flags.BoolVarP(&podStopCommand.All, "all", "a", false, "Stop all running pods") flags.BoolVarP(&podStopCommand.Latest, "latest", "l", false, "Stop the latest pod podman is aware of") diff --git a/cmd/podman/pod_top.go b/cmd/podman/pod_top.go index f1db2fac5..411c782bd 100644 --- a/cmd/podman/pod_top.go +++ b/cmd/podman/pod_top.go @@ -39,6 +39,7 @@ the latest pod. func init() { podTopCommand.Command = _podTopCommand + podTopCommand.SetUsageTemplate(UsageTemplate()) flags := podTopCommand.Flags() flags.BoolVarP(&podTopCommand.Latest, "latest,", "l", false, "Act on the latest pod podman is aware of") flags.BoolVar(&podTopCommand.ListDescriptors, "list-descriptors", false, "") diff --git a/cmd/podman/pod_unpause.go b/cmd/podman/pod_unpause.go index 17b771d4a..a917919c3 100644 --- a/cmd/podman/pod_unpause.go +++ b/cmd/podman/pod_unpause.go @@ -28,6 +28,7 @@ var ( func init() { podUnpauseCommand.Command = _podUnpauseCommand + podUnpauseCommand.SetUsageTemplate(UsageTemplate()) flags := podUnpauseCommand.Flags() flags.BoolVarP(&podUnpauseCommand.All, "all", "a", false, "Unpause all running pods") flags.BoolVarP(&podUnpauseCommand.Latest, "latest", "l", false, "Unpause the latest pod podman is aware of") diff --git a/cmd/podman/port.go b/cmd/podman/port.go index 6b458c3c8..5a5b6127b 100644 --- a/cmd/podman/port.go +++ b/cmd/podman/port.go @@ -34,6 +34,7 @@ var ( func init() { portCommand.Command = _portCommand + portCommand.SetUsageTemplate(UsageTemplate()) flags := portCommand.Flags() flags.BoolVarP(&portCommand.All, "all", "a", false, "Display port information for all containers") diff --git a/cmd/podman/ps.go b/cmd/podman/ps.go index dd5bf0ff2..949f78a34 100644 --- a/cmd/podman/ps.go +++ b/cmd/podman/ps.go @@ -172,6 +172,7 @@ var ( func init() { psCommand.Command = _psCommand + psCommand.SetUsageTemplate(UsageTemplate()) flags := psCommand.Flags() flags.BoolVarP(&psCommand.All, "all", "a", false, "Show all the containers, default is only running containers") flags.StringSliceVarP(&psCommand.Filter, "filter", "f", []string{}, "Filter output based on conditions given") diff --git a/cmd/podman/pull.go b/cmd/podman/pull.go index ad1469403..6d9d1a278 100644 --- a/cmd/podman/pull.go +++ b/cmd/podman/pull.go @@ -40,6 +40,7 @@ specified, the image with the 'latest' tag (if it exists) is pulled func init() { pullCommand.Command = _pullCommand + pullCommand.SetUsageTemplate(UsageTemplate()) flags := pullCommand.Flags() flags.StringVar(&pullCommand.Authfile, "authfile", "", "Path of the authentication file. Default is ${XDG_RUNTIME_DIR}/containers/auth.json. Use REGISTRY_AUTH_FILE environment variable to override") flags.StringVar(&pullCommand.CertDir, "cert-dir", "", "`Pathname` of a directory containing TLS certificates and keys") diff --git a/cmd/podman/push.go b/cmd/podman/push.go index 49786e86f..017e4fbd2 100644 --- a/cmd/podman/push.go +++ b/cmd/podman/push.go @@ -40,6 +40,7 @@ var ( func init() { pushCommand.Command = _pushCommand + pushCommand.SetUsageTemplate(UsageTemplate()) flags := pushCommand.Flags() flags.MarkHidden("signature-policy") flags.StringVar(&pushCommand.Authfile, "authfile", "", "Path of the authentication file. Default is ${XDG_RUNTIME_DIR}/containers/auth.json. Use REGISTRY_AUTH_FILE environment variable to override") diff --git a/cmd/podman/refresh.go b/cmd/podman/refresh.go index 32b274169..641748452 100644 --- a/cmd/podman/refresh.go +++ b/cmd/podman/refresh.go @@ -27,6 +27,7 @@ var ( func init() { refreshCommand.Command = _refreshCommand + refreshCommand.SetUsageTemplate(UsageTemplate()) } func refreshCmd(c *cliconfig.RefreshValues) error { diff --git a/cmd/podman/restart.go b/cmd/podman/restart.go index a305b364a..235107b5c 100644 --- a/cmd/podman/restart.go +++ b/cmd/podman/restart.go @@ -32,6 +32,7 @@ var ( func init() { restartCommand.Command = _restartCommand + restartCommand.SetUsageTemplate(UsageTemplate()) flags := restartCommand.Flags() flags.BoolVarP(&restartCommand.All, "all", "a", false, "Restart all non-running containers") flags.BoolVarP(&restartCommand.Latest, "latest", "l", false, "Act on the latest container podman is aware of") diff --git a/cmd/podman/restore.go b/cmd/podman/restore.go index 5f28c3087..556cdb774 100644 --- a/cmd/podman/restore.go +++ b/cmd/podman/restore.go @@ -35,6 +35,7 @@ var ( func init() { restoreCommand.Command = _restoreCommand + restoreCommand.SetUsageTemplate(UsageTemplate()) flags := restoreCommand.Flags() flags.BoolVarP(&restoreCommand.All, "all", "a", false, "Restore all checkpointed containers") flags.BoolVarP(&restoreCommand.Keep, "keep", "k", false, "Keep all temporary checkpoint files") diff --git a/cmd/podman/rm.go b/cmd/podman/rm.go index f8aef6461..1e5e9d254 100644 --- a/cmd/podman/rm.go +++ b/cmd/podman/rm.go @@ -34,6 +34,7 @@ Running containers will not be removed without the -f option. func init() { rmCommand.Command = _rmCommand + rmCommand.SetUsageTemplate(UsageTemplate()) flags := rmCommand.Flags() flags.BoolVarP(&rmCommand.All, "all", "a", false, "Remove all containers") flags.BoolVarP(&rmCommand.Force, "force", "f", false, "Force removal of a running container. The default is false") diff --git a/cmd/podman/rmi.go b/cmd/podman/rmi.go index 4572fd530..c5bd1e190 100644 --- a/cmd/podman/rmi.go +++ b/cmd/podman/rmi.go @@ -29,6 +29,7 @@ var ( func init() { rmiCommand.Command = _rmiCommand + rmiCommand.SetUsageTemplate(UsageTemplate()) flags := rmiCommand.Flags() flags.BoolVarP(&rmiCommand.All, "all", "a", false, "Remove all images") flags.BoolVarP(&rmiCommand.Force, "force", "f", false, "Force Removal of the image") diff --git a/cmd/podman/run.go b/cmd/podman/run.go index 897e2d1b3..8649dc190 100644 --- a/cmd/podman/run.go +++ b/cmd/podman/run.go @@ -18,28 +18,29 @@ import ( ) var ( - runCommmand cliconfig.RunValues + runCommand cliconfig.RunValues runDescription = "Runs a command in a new container from the given image" - _runCommmand = &cobra.Command{ + _runCommand = &cobra.Command{ Use: "run", Short: "Run a command in a new container", Long: runDescription, RunE: func(cmd *cobra.Command, args []string) error { - runCommmand.InputArgs = args - runCommmand.GlobalFlags = MainGlobalOpts - return runCmd(&runCommmand) + runCommand.InputArgs = args + runCommand.GlobalFlags = MainGlobalOpts + return runCmd(&runCommand) }, Example: "IMAGE [COMMAND [ARG...]]", } ) func init() { - runCommmand.Command = _runCommmand - flags := runCommmand.Flags() + runCommand.Command = _runCommand + runCommand.SetUsageTemplate(UsageTemplate()) + flags := runCommand.Flags() flags.SetInterspersed(false) flags.Bool("sig-proxy", true, "Proxy received signals to the process (default true)") - getCreateFlags(&runCommmand.PodmanCommand) + getCreateFlags(&runCommand.PodmanCommand) } func runCmd(c *cliconfig.RunValues) error { diff --git a/cmd/podman/runlabel.go b/cmd/podman/runlabel.go index ff8a282d3..f1c61ebda 100644 --- a/cmd/podman/runlabel.go +++ b/cmd/podman/runlabel.go @@ -37,6 +37,7 @@ Executes a command as described by a container image label. func init() { runlabelCommand.Command = _runlabelCommand + runlabelCommand.SetUsageTemplate(UsageTemplate()) flags := runlabelCommand.Flags() flags.StringVar(&runlabelCommand.Authfile, "authfile", "", "Path of the authentication file. Default is ${XDG_RUNTIME_DIR}/containers/auth.json. Use REGISTRY_AUTH_FILE environment variable to override") flags.StringVar(&runlabelCommand.CertDir, "cert-dir", "", "`Pathname` of a directory containing TLS certificates and keys") diff --git a/cmd/podman/save.go b/cmd/podman/save.go index 62b891358..1ae1bc872 100644 --- a/cmd/podman/save.go +++ b/cmd/podman/save.go @@ -47,6 +47,7 @@ var ( func init() { saveCommand.Command = _saveCommand + saveCommand.SetUsageTemplate(UsageTemplate()) flags := saveCommand.Flags() flags.BoolVar(&saveCommand.Compress, "compress", false, "Compress tarball image layers when saving to a directory using the 'dir' transport. (default is same compression type as source)") flags.StringVar(&saveCommand.Format, "format", "", "Save image to oci-archive, oci-dir (directory with oci manifest type), docker-dir (directory with v2s2 manifest type)") diff --git a/cmd/podman/search.go b/cmd/podman/search.go index 10c29c918..2febee689 100644 --- a/cmd/podman/search.go +++ b/cmd/podman/search.go @@ -43,6 +43,7 @@ var ( func init() { searchCommand.Command = _searchCommand + searchCommand.SetUsageTemplate(UsageTemplate()) flags := searchCommand.Flags() flags.StringVar(&searchCommand.Authfile, "authfile", "", "Path of the authentication file. Default is ${XDG_RUNTIME_DIR}/containers/auth.json. Use REGISTRY_AUTH_FILE environment variable to override") flags.StringSliceVarP(&searchCommand.Filter, "filter", "f", []string{}, "Filter output based on conditions provided (default [])") diff --git a/cmd/podman/sign.go b/cmd/podman/sign.go index 2c3f6c09f..ac0d985f5 100644 --- a/cmd/podman/sign.go +++ b/cmd/podman/sign.go @@ -38,6 +38,7 @@ var ( func init() { signCommand.Command = _signCommand + signCommand.SetUsageTemplate(UsageTemplate()) flags := signCommand.Flags() flags.StringVarP(&signCommand.Directory, "directory", "d", "", "Define an alternate directory to store signatures") flags.StringVar(&signCommand.SignBy, "sign-by", "", "Name of the signing key") diff --git a/cmd/podman/start.go b/cmd/podman/start.go index 3a03db47a..344719fca 100644 --- a/cmd/podman/start.go +++ b/cmd/podman/start.go @@ -36,6 +36,7 @@ var ( func init() { startCommand.Command = _startCommand + startCommand.SetUsageTemplate(UsageTemplate()) flags := startCommand.Flags() flags.BoolVarP(&startCommand.Attach, "attach", "a", false, "Attach container's STDOUT and STDERR") flags.StringVar(&startCommand.DetachKeys, "detach-keys", "", "Override the key sequence for detaching a container. Format is a single character [a-Z] or ctrl-<value> where <value> is one of: a-z, @, ^, [, , or _") diff --git a/cmd/podman/stats.go b/cmd/podman/stats.go index 2af7fb9ea..af9bbad0e 100644 --- a/cmd/podman/stats.go +++ b/cmd/podman/stats.go @@ -47,6 +47,7 @@ var ( func init() { statsCommand.Command = _statsCommand + statsCommand.SetUsageTemplate(UsageTemplate()) flags := statsCommand.Flags() flags.BoolVarP(&statsCommand.All, "all", "a", false, "Show all containers. Only running containers are shown by default. The default is false") flags.StringVar(&statsCommand.Format, "format", "", "Pretty-print container statistics to JSON or using a Go template") diff --git a/cmd/podman/stop.go b/cmd/podman/stop.go index 4700b2dde..134d8a069 100644 --- a/cmd/podman/stop.go +++ b/cmd/podman/stop.go @@ -37,6 +37,7 @@ var ( func init() { stopCommand.Command = _stopCommand + stopCommand.SetUsageTemplate(UsageTemplate()) flags := stopCommand.Flags() flags.BoolVarP(&stopCommand.All, "all", "a", false, "Stop all running containers") flags.BoolVarP(&stopCommand.Latest, "latest", "l", false, "Act on the latest container podman is aware of") diff --git a/cmd/podman/system.go b/cmd/podman/system.go index b6bc1bfef..741b79da5 100644 --- a/cmd/podman/system.go +++ b/cmd/podman/system.go @@ -24,4 +24,5 @@ var systemCommands = []*cobra.Command{ func init() { systemCommand.AddCommand(systemCommands...) systemCommand.AddCommand(getSystemSubCommands()...) + systemCommand.SetUsageTemplate(UsageTemplate()) } diff --git a/cmd/podman/system_prune.go b/cmd/podman/system_prune.go index c918fbe3b..a88027558 100644 --- a/cmd/podman/system_prune.go +++ b/cmd/podman/system_prune.go @@ -34,8 +34,8 @@ var ( ) func init() { - pruneSystemCommand.Command = _pruneSystemCommand + pruneSystemCommand.SetUsageTemplate(UsageTemplate()) flags := pruneSystemCommand.Flags() flags.BoolVarP(&pruneSystemCommand.All, "all", "a", false, "Remove all unused data") flags.BoolVarP(&pruneSystemCommand.Force, "force", "f", false, "Do not prompt for confirmation") diff --git a/cmd/podman/tag.go b/cmd/podman/tag.go index fdd29fc83..135c2f7a0 100644 --- a/cmd/podman/tag.go +++ b/cmd/podman/tag.go @@ -26,6 +26,7 @@ var ( func init() { tagCommand.Command = _tagCommand + tagCommand.SetUsageTemplate(UsageTemplate()) } func tagCmd(c *cliconfig.TagValues) error { diff --git a/cmd/podman/top.go b/cmd/podman/top.go index 8555f701e..51b813e5a 100644 --- a/cmd/podman/top.go +++ b/cmd/podman/top.go @@ -48,6 +48,7 @@ the latest container. func init() { topCommand.Command = _topCommand + topCommand.SetUsageTemplate(UsageTemplate()) flags := topCommand.Flags() flags.BoolVar(&topCommand.ListDescriptors, "list-descriptors", false, "") flags.MarkHidden("list-descriptors") diff --git a/cmd/podman/trust.go b/cmd/podman/trust.go index 6304586c3..8b02dcdc6 100644 --- a/cmd/podman/trust.go +++ b/cmd/podman/trust.go @@ -16,6 +16,7 @@ var ( ) func init() { + trustCommand.SetUsageTemplate(UsageTemplate()) trustCommand.AddCommand(getTrustSubCommands()...) imageCommand.AddCommand(trustCommand.Command) } diff --git a/cmd/podman/trust_set_show.go b/cmd/podman/trust_set_show.go index cd9438220..f3d1cadce 100644 --- a/cmd/podman/trust_set_show.go +++ b/cmd/podman/trust_set_show.go @@ -49,9 +49,10 @@ var ( ) func init() { - setTrustCommand.Command = _setTrustCommand + setTrustCommand.SetUsageTemplate(UsageTemplate()) showTrustCommand.Command = _showTrustCommand + showTrustCommand.SetUsageTemplate(UsageTemplate()) setFlags := setTrustCommand.Flags() setFlags.StringVar(&setTrustCommand.PolicyPath, "policypath", "", "") setFlags.MarkHidden("policypath") diff --git a/cmd/podman/umount.go b/cmd/podman/umount.go index 453560641..20ea410c2 100644 --- a/cmd/podman/umount.go +++ b/cmd/podman/umount.go @@ -37,6 +37,7 @@ An unmount can be forced with the --force flag. func init() { umountCommand.Command = _umountCommand + umountCommand.SetUsageTemplate(UsageTemplate()) flags := umountCommand.Flags() flags.BoolVarP(&umountCommand.All, "all", "a", false, "Umount all of the currently mounted containers") flags.BoolVarP(&umountCommand.Force, "force", "f", false, "Force the complete umount all of the currently mounted containers") diff --git a/cmd/podman/unpause.go b/cmd/podman/unpause.go index de4e71ad9..c8f85cfd3 100644 --- a/cmd/podman/unpause.go +++ b/cmd/podman/unpause.go @@ -35,6 +35,7 @@ var ( func init() { unpauseCommand.Command = _unpauseCommand + unpauseCommand.SetUsageTemplate(UsageTemplate()) flags := unpauseCommand.Flags() flags.BoolVarP(&unpauseCommand.All, "all", "a", false, "Unpause all paused containers") } diff --git a/cmd/podman/varlink.go b/cmd/podman/varlink.go index 73ffcdb3f..a49aae55b 100644 --- a/cmd/podman/varlink.go +++ b/cmd/podman/varlink.go @@ -38,6 +38,7 @@ var ( func init() { varlinkCommand.Command = _varlinkCommand + varlinkCommand.SetUsageTemplate(UsageTemplate()) flags := varlinkCommand.Flags() flags.Int64VarP(&varlinkCommand.Timeout, "timeout", "t", 1000, "Time until the varlink session expires in milliseconds. Use 0 to disable the timeout") } diff --git a/cmd/podman/version.go b/cmd/podman/version.go index 766dfdc0b..c65ba94f9 100644 --- a/cmd/podman/version.go +++ b/cmd/podman/version.go @@ -28,6 +28,7 @@ var ( func init() { versionCommand.Command = _versionCommand + versionCommand.SetUsageTemplate(UsageTemplate()) flags := versionCommand.Flags() flags.StringVarP(&versionCommand.Format, "format", "f", "", "Change the output format to JSON or a Go template") } diff --git a/cmd/podman/volume.go b/cmd/podman/volume.go index d63db82e4..36798a19e 100644 --- a/cmd/podman/volume.go +++ b/cmd/podman/volume.go @@ -19,4 +19,5 @@ var volumeCommand = cliconfig.PodmanCommand{ func init() { volumeCommand.AddCommand(getVolumeSubCommands()...) + volumeCommand.SetUsageTemplate(UsageTemplate()) } diff --git a/cmd/podman/volume_create.go b/cmd/podman/volume_create.go index 238579501..fe5d69e0b 100644 --- a/cmd/podman/volume_create.go +++ b/cmd/podman/volume_create.go @@ -32,6 +32,7 @@ be created at.` func init() { volumeCreateCommand.Command = _volumeCreateCommand + volumeCreateCommand.SetUsageTemplate(UsageTemplate()) flags := volumeCreateCommand.Flags() flags.StringVar(&volumeCreateCommand.Driver, "driver", "", "Specify volume driver name (default local)") flags.StringSliceVarP(&volumeCreateCommand.Label, "label", "l", []string{}, "Set metadata for a volume (default [])") diff --git a/cmd/podman/volume_inspect.go b/cmd/podman/volume_inspect.go index 7cb5703da..a8e6f489f 100644 --- a/cmd/podman/volume_inspect.go +++ b/cmd/podman/volume_inspect.go @@ -31,6 +31,7 @@ from JSON to a Go template. func init() { volumeInspectCommand.Command = _volumeInspectCommand + volumeInspectCommand.SetUsageTemplate(UsageTemplate()) flags := volumeInspectCommand.Flags() flags.BoolVarP(&volumeInspectCommand.All, "all", "a", false, "Inspect all volumes") flags.StringVarP(&volumeInspectCommand.Format, "format", "f", "json", "Format volume output using Go template") diff --git a/cmd/podman/volume_ls.go b/cmd/podman/volume_ls.go index 78fdfed64..87b14a4b2 100644 --- a/cmd/podman/volume_ls.go +++ b/cmd/podman/volume_ls.go @@ -62,6 +62,7 @@ and the output format can be changed to JSON or a user specified Go template. func init() { volumeLsCommand.Command = _volumeLsCommand + volumeLsCommand.SetUsageTemplate(UsageTemplate()) flags := volumeLsCommand.Flags() flags.StringVarP(&volumeLsCommand.Filter, "filter", "f", "", "Filter volume output") diff --git a/cmd/podman/volume_prune.go b/cmd/podman/volume_prune.go index 29dc6ead4..74228fa5b 100644 --- a/cmd/podman/volume_prune.go +++ b/cmd/podman/volume_prune.go @@ -37,6 +37,7 @@ using force. func init() { volumePruneCommand.Command = _volumePruneCommand + volumePruneCommand.SetUsageTemplate(UsageTemplate()) flags := volumePruneCommand.Flags() flags.BoolVarP(&volumePruneCommand.Force, "force", "f", false, "Do not prompt for confirmation") diff --git a/cmd/podman/volume_rm.go b/cmd/podman/volume_rm.go index b02a06ed9..c23555b51 100644 --- a/cmd/podman/volume_rm.go +++ b/cmd/podman/volume_rm.go @@ -35,6 +35,7 @@ not being used by any containers. To remove the volumes anyways, use the func init() { volumeRmCommand.Command = _volumeRmCommand + volumeRmCommand.SetUsageTemplate(UsageTemplate()) flags := volumeRmCommand.Flags() flags.BoolVarP(&volumeRmCommand.All, "all", "a", false, "Remove all volumes") flags.BoolVarP(&volumeRmCommand.Force, "force", "f", false, "Remove a volume by force, even if it is being used by a container") diff --git a/cmd/podman/wait.go b/cmd/podman/wait.go index 9d2441b8f..616c8feb5 100644 --- a/cmd/podman/wait.go +++ b/cmd/podman/wait.go @@ -34,6 +34,7 @@ var ( func init() { waitCommand.Command = _waitCommand + waitCommand.SetUsageTemplate(UsageTemplate()) flags := waitCommand.Flags() flags.UintVarP(&waitCommand.Interval, "interval", "i", 250, "Milliseconds to wait before polling for completion") flags.BoolVarP(&waitCommand.Latest, "latest", "l", false, "Act on the latest container podman is aware of") |