diff options
author | baude <bbaude@redhat.com> | 2019-02-21 17:09:59 -0600 |
---|---|---|
committer | baude <bbaude@redhat.com> | 2019-02-22 14:13:08 -0600 |
commit | 6ab6e2c3073d47755d441ee8c1bce90e34082e99 (patch) | |
tree | 38b123449c3b4270acec7f680b688ddb2c502204 /cmd | |
parent | 328250e7bef56b0b69dbea124c1170abd289900f (diff) | |
download | podman-6ab6e2c3073d47755d441ee8c1bce90e34082e99.tar.gz podman-6ab6e2c3073d47755d441ee8c1bce90e34082e99.tar.bz2 podman-6ab6e2c3073d47755d441ee8c1bce90e34082e99.zip |
hide --latest on the remote-client
in the case of the remote-client, it was decided to hide the latest
flag to avoid confusion for end-users on what the "last" container,
volume, or pod are.
Signed-off-by: baude <bbaude@redhat.com>
Diffstat (limited to 'cmd')
32 files changed, 42 insertions, 5 deletions
diff --git a/cmd/podman/attach.go b/cmd/podman/attach.go index b70ff649c..074675e45 100644 --- a/cmd/podman/attach.go +++ b/cmd/podman/attach.go @@ -35,8 +35,8 @@ func init() { 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") flags.BoolVar(&attachCommand.SigProxy, "sig-proxy", true, "Proxy received signals to the process (default true)") - flags.BoolVarP(&attachCommand.Latest, "latest", "l", false, "Act on the latest container podman is aware of") + markFlagHiddenForRemoteClient("latest", flags) } func attachCmd(c *cliconfig.AttachValues) error { diff --git a/cmd/podman/checkpoint.go b/cmd/podman/checkpoint.go index 5b043ed81..c9de5638b 100644 --- a/cmd/podman/checkpoint.go +++ b/cmd/podman/checkpoint.go @@ -48,6 +48,7 @@ func init() { flags.BoolVar(&checkpointCommand.TcpEstablished, "tcp-established", false, "Checkpoint a container with established TCP connections") flags.BoolVarP(&checkpointCommand.All, "all", "a", false, "Checkpoint all running containers") flags.BoolVarP(&checkpointCommand.Latest, "latest", "l", false, "Act on the latest container podman is aware of") + markFlagHiddenForRemoteClient("latest", flags) } func checkpointCmd(c *cliconfig.CheckpointValues) error { diff --git a/cmd/podman/cleanup.go b/cmd/podman/cleanup.go index 58ac80624..d68255aa2 100644 --- a/cmd/podman/cleanup.go +++ b/cmd/podman/cleanup.go @@ -43,6 +43,7 @@ func init() { flags.BoolVarP(&cleanupCommand.All, "all", "a", false, "Cleans up all containers") flags.BoolVarP(&cleanupCommand.Latest, "latest", "l", false, "Act on the latest container podman is aware of") flags.BoolVar(&cleanupCommand.Remove, "rm", false, "After cleanup, remove the container entirely") + markFlagHiddenForRemoteClient("latest", flags) } func cleanupCmd(c *cliconfig.CleanupValues) error { diff --git a/cmd/podman/commands.go b/cmd/podman/commands.go index 0acb9c398..2a87afaf8 100644 --- a/cmd/podman/commands.go +++ b/cmd/podman/commands.go @@ -6,6 +6,8 @@ import ( "github.com/spf13/cobra" ) +const remoteclient = false + // Commands that the local client implements func getMainCommands() []*cobra.Command { rootCommands := []*cobra.Command{ diff --git a/cmd/podman/commands_remoteclient.go b/cmd/podman/commands_remoteclient.go index ba0a4d47e..081043b25 100644 --- a/cmd/podman/commands_remoteclient.go +++ b/cmd/podman/commands_remoteclient.go @@ -6,6 +6,8 @@ import ( "github.com/spf13/cobra" ) +const remoteclient = true + // commands that only the remoteclient implements func getMainCommands() []*cobra.Command { return []*cobra.Command{} diff --git a/cmd/podman/exec.go b/cmd/podman/exec.go index 9599be528..7040a7b09 100644 --- a/cmd/podman/exec.go +++ b/cmd/podman/exec.go @@ -48,7 +48,7 @@ func init() { flags.StringVarP(&execCommand.User, "user", "u", "", "Sets the username or UID used and optionally the groupname or GID for the specified command") flags.StringVarP(&execCommand.Workdir, "workdir", "w", "", "Working directory inside the container") - + markFlagHiddenForRemoteClient("latest", flags) } func execCmd(c *cliconfig.ExecValues) error { diff --git a/cmd/podman/inspect.go b/cmd/podman/inspect.go index a1f3ef81f..48b953207 100644 --- a/cmd/podman/inspect.go +++ b/cmd/podman/inspect.go @@ -48,7 +48,7 @@ func init() { flags.StringVarP(&inspectCommand.Format, "format", "f", "", "Change the output format to a Go template") flags.BoolVarP(&inspectCommand.Latest, "latest", "l", false, "Act on the latest container podman is aware of if the type is a container") flags.BoolVarP(&inspectCommand.Size, "size", "s", false, "Display total file size if the type is container") - + markFlagHiddenForRemoteClient("latest", flags) } func inspectCmd(c *cliconfig.InspectValues) error { diff --git a/cmd/podman/kill.go b/cmd/podman/kill.go index 373938d97..eb72d53e7 100644 --- a/cmd/podman/kill.go +++ b/cmd/podman/kill.go @@ -46,6 +46,7 @@ func init() { flags.StringVarP(&killCommand.Signal, "signal", "s", "KILL", "Signal to send to the container") flags.BoolVarP(&killCommand.Latest, "latest", "l", false, "Act on the latest container podman is aware of") + markFlagHiddenForRemoteClient("latest", flags) } // killCmd kills one or more containers with a signal diff --git a/cmd/podman/logs.go b/cmd/podman/logs.go index 4cf3b7cb8..97d835d8f 100644 --- a/cmd/podman/logs.go +++ b/cmd/podman/logs.go @@ -46,6 +46,7 @@ func init() { flags.SetInterspersed(false) + markFlagHiddenForRemoteClient("latest", flags) } func logsCmd(c *cliconfig.LogsValues) error { diff --git a/cmd/podman/mount.go b/cmd/podman/mount.go index 8d7ab9907..f4a7bd5ea 100644 --- a/cmd/podman/mount.go +++ b/cmd/podman/mount.go @@ -49,6 +49,7 @@ func init() { flags.BoolVarP(&mountCommand.Latest, "latest", "l", false, "Act on the latest container podman is aware of") flags.BoolVar(&mountCommand.NoTrunc, "notruncate", false, "Do not truncate output") + markFlagHiddenForRemoteClient("latest", flags) } // jsonMountPoint stores info about each container diff --git a/cmd/podman/pod_inspect.go b/cmd/podman/pod_inspect.go index e06a7dce9..fb7310211 100644 --- a/cmd/podman/pod_inspect.go +++ b/cmd/podman/pod_inspect.go @@ -33,6 +33,7 @@ func init() { flags := podInspectCommand.Flags() flags.BoolVarP(&podInspectCommand.Latest, "latest", "l", false, "Act on the latest container podman is aware of") + markFlagHiddenForRemoteClient("latest", flags) } func podInspectCmd(c *cliconfig.PodInspectValues) error { diff --git a/cmd/podman/pod_kill.go b/cmd/podman/pod_kill.go index 7e904f764..d0318b409 100644 --- a/cmd/podman/pod_kill.go +++ b/cmd/podman/pod_kill.go @@ -40,6 +40,7 @@ func init() { 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") flags.StringVarP(&podKillCommand.Signal, "signal", "s", "KILL", "Signal to send to the containers in the pod") + markFlagHiddenForRemoteClient("latest", flags) } // podKillCmd kills one or more pods with a signal diff --git a/cmd/podman/pod_pause.go b/cmd/podman/pod_pause.go index 0717e6cff..e01d73c9b 100644 --- a/cmd/podman/pod_pause.go +++ b/cmd/podman/pod_pause.go @@ -36,6 +36,7 @@ func init() { 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") + markFlagHiddenForRemoteClient("latest", flags) } func podPauseCmd(c *cliconfig.PodPauseValues) error { diff --git a/cmd/podman/pod_ps.go b/cmd/podman/pod_ps.go index 49af91a1e..85467b6ad 100644 --- a/cmd/podman/pod_ps.go +++ b/cmd/podman/pod_ps.go @@ -144,7 +144,7 @@ func init() { flags.BoolVar(&podPsCommand.NoTrunc, "no-trunc", false, "Do not truncate pod and container IDs") flags.BoolVarP(&podPsCommand.Quiet, "quiet", "q", false, "Print the numeric IDs of the pods only") flags.StringVar(&podPsCommand.Sort, "sort", "created", "Sort output by created, id, name, or number") - + markFlagHiddenForRemoteClient("latest", flags) } func podPsCmd(c *cliconfig.PodPsValues) error { diff --git a/cmd/podman/pod_restart.go b/cmd/podman/pod_restart.go index fe24f26ba..be54630db 100644 --- a/cmd/podman/pod_restart.go +++ b/cmd/podman/pod_restart.go @@ -38,6 +38,7 @@ func init() { 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") + markFlagHiddenForRemoteClient("latest", flags) } func podRestartCmd(c *cliconfig.PodRestartValues) error { diff --git a/cmd/podman/pod_rm.go b/cmd/podman/pod_rm.go index 6bb4b3d11..b552b9f42 100644 --- a/cmd/podman/pod_rm.go +++ b/cmd/podman/pod_rm.go @@ -42,7 +42,7 @@ func init() { 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") flags.BoolVarP(&podRmCommand.Latest, "latest", "l", false, "Remove the latest pod podman is aware of") - + markFlagHiddenForRemoteClient("latest", flags) } // podRmCmd deletes pods diff --git a/cmd/podman/pod_start.go b/cmd/podman/pod_start.go index a04029e79..3bba5c2e9 100644 --- a/cmd/podman/pod_start.go +++ b/cmd/podman/pod_start.go @@ -41,6 +41,7 @@ func init() { 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") + markFlagHiddenForRemoteClient("latest", flags) } func podStartCmd(c *cliconfig.PodStartValues) error { diff --git a/cmd/podman/pod_stats.go b/cmd/podman/pod_stats.go index b1779532f..907d6a547 100644 --- a/cmd/podman/pod_stats.go +++ b/cmd/podman/pod_stats.go @@ -47,6 +47,7 @@ func init() { flags.BoolVarP(&podStatsCommand.Latest, "latest", "l", false, "Provide stats on the latest pod podman is aware of") flags.BoolVar(&podStatsCommand.NoStream, "no-stream", false, "Disable streaming stats and only pull the first result, default setting is false") flags.BoolVar(&podStatsCommand.NoReset, "no-reset", false, "Disable resetting the screen between intervals") + markFlagHiddenForRemoteClient("latest", flags) } func podStatsCmd(c *cliconfig.PodStatsValues) error { diff --git a/cmd/podman/pod_stop.go b/cmd/podman/pod_stop.go index a3816b1e1..52c92b521 100644 --- a/cmd/podman/pod_stop.go +++ b/cmd/podman/pod_stop.go @@ -43,6 +43,7 @@ func init() { 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") flags.UintVarP(&podStopCommand.Timeout, "timeout", "t", 0, "Seconds to wait for pod stop before killing the container") + markFlagHiddenForRemoteClient("latest", flags) } func podStopCmd(c *cliconfig.PodStopValues) error { diff --git a/cmd/podman/pod_unpause.go b/cmd/podman/pod_unpause.go index b860000af..35128e87b 100644 --- a/cmd/podman/pod_unpause.go +++ b/cmd/podman/pod_unpause.go @@ -37,6 +37,7 @@ func init() { 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") + markFlagHiddenForRemoteClient("latest", flags) } func podUnpauseCmd(c *cliconfig.PodUnpauseValues) error { diff --git a/cmd/podman/port.go b/cmd/podman/port.go index 6a15db88d..bcf372a51 100644 --- a/cmd/podman/port.go +++ b/cmd/podman/port.go @@ -45,6 +45,7 @@ func init() { flags.BoolVarP(&portCommand.All, "all", "a", false, "Display port information for all containers") flags.BoolVarP(&portCommand.Latest, "latest", "l", false, "Act on the latest container podman is aware of") + markFlagHiddenForRemoteClient("latest", flags) } func portCmd(c *cliconfig.PortValues) error { diff --git a/cmd/podman/ps.go b/cmd/podman/ps.go index d7f0d9da0..9c165b836 100644 --- a/cmd/podman/ps.go +++ b/cmd/podman/ps.go @@ -191,6 +191,7 @@ func init() { flags.StringVar(&psCommand.Sort, "sort", "created", "Sort output by command, created, id, image, names, runningfor, size, or status") flags.BoolVar(&psCommand.Sync, "sync", false, "Sync container state with OCI runtime") + markFlagHiddenForRemoteClient("latest", flags) } func psCmd(c *cliconfig.PsValues) error { diff --git a/cmd/podman/restart.go b/cmd/podman/restart.go index 20af0e69a..58fb38874 100644 --- a/cmd/podman/restart.go +++ b/cmd/podman/restart.go @@ -45,6 +45,7 @@ func init() { flags.UintVarP(&restartCommand.Timeout, "timeout", "t", libpod.CtrRemoveTimeout, "Seconds to wait for stop before killing the container") flags.UintVar(&restartCommand.Timeout, "time", libpod.CtrRemoveTimeout, "Seconds to wait for stop before killing the container") + markFlagHiddenForRemoteClient("latest", flags) } func restartCmd(c *cliconfig.RestartValues) error { diff --git a/cmd/podman/restore.go b/cmd/podman/restore.go index eb4d6a6c5..5f6e7b892 100644 --- a/cmd/podman/restore.go +++ b/cmd/podman/restore.go @@ -48,6 +48,7 @@ func init() { // TODO: add ContainerStateCheckpointed flags.BoolVar(&restoreCommand.TcpEstablished, "tcp-established", false, "Checkpoint a container with established TCP connections") + markFlagHiddenForRemoteClient("latest", flags) } func restoreCmd(c *cliconfig.RestoreValues) error { diff --git a/cmd/podman/rm.go b/cmd/podman/rm.go index 8ff2ee727..01ed70f52 100644 --- a/cmd/podman/rm.go +++ b/cmd/podman/rm.go @@ -45,6 +45,7 @@ func init() { flags.BoolVarP(&rmCommand.Force, "force", "f", false, "Force removal of a running container. The default is false") flags.BoolVarP(&rmCommand.Latest, "latest", "l", false, "Act on the latest container podman is aware of") flags.BoolVarP(&rmCommand.Volumes, "volumes", "v", false, "Remove the volumes associated with the container") + markFlagHiddenForRemoteClient("latest", flags) } // saveCmd saves the image to either docker-archive or oci diff --git a/cmd/podman/start.go b/cmd/podman/start.go index db8abae83..c645a35c4 100644 --- a/cmd/podman/start.go +++ b/cmd/podman/start.go @@ -44,6 +44,7 @@ func init() { flags.BoolVarP(&startCommand.Interactive, "interactive", "i", false, "Keep STDIN open even if not attached") flags.BoolVarP(&startCommand.Latest, "latest", "l", false, "Act on the latest container podman is aware of") flags.BoolVar(&startCommand.SigProxy, "sig-proxy", true, "Proxy received signals to the process (default true if attaching, false otherwise)") + markFlagHiddenForRemoteClient("latest", flags) } func startCmd(c *cliconfig.StartValues) error { diff --git a/cmd/podman/stats.go b/cmd/podman/stats.go index 3f5493102..2bbcd0a17 100644 --- a/cmd/podman/stats.go +++ b/cmd/podman/stats.go @@ -59,6 +59,7 @@ func init() { flags.BoolVarP(&statsCommand.Latest, "latest", "l", false, "Act on the latest container podman is aware of") flags.BoolVar(&statsCommand.NoReset, "no-reset", false, "Disable resetting the screen between intervals") flags.BoolVar(&statsCommand.NoStream, "no-stream", false, "Disable streaming stats and only pull the first result, default setting is false") + markFlagHiddenForRemoteClient("latest", flags) } func statsCmd(c *cliconfig.StatsValues) error { diff --git a/cmd/podman/stop.go b/cmd/podman/stop.go index f2a1aa118..67c15b2a8 100644 --- a/cmd/podman/stop.go +++ b/cmd/podman/stop.go @@ -49,6 +49,7 @@ func init() { flags.BoolVarP(&stopCommand.Latest, "latest", "l", false, "Act on the latest container podman is aware of") flags.UintVar(&stopCommand.Timeout, "time", libpod.CtrRemoveTimeout, "Seconds to wait for stop before killing the container") flags.UintVarP(&stopCommand.Timeout, "timeout", "t", libpod.CtrRemoveTimeout, "Seconds to wait for stop before killing the container") + markFlagHiddenForRemoteClient("latest", flags) } func stopCmd(c *cliconfig.StopValues) error { diff --git a/cmd/podman/top.go b/cmd/podman/top.go index d85e1be53..36d6bb6b4 100644 --- a/cmd/podman/top.go +++ b/cmd/podman/top.go @@ -55,6 +55,7 @@ func init() { flags.BoolVar(&topCommand.ListDescriptors, "list-descriptors", false, "") flags.MarkHidden("list-descriptors") flags.BoolVarP(&topCommand.Latest, "latest", "l", false, "Act on the latest container podman is aware of") + markFlagHiddenForRemoteClient("latest", flags) } func topCmd(c *cliconfig.TopValues) error { diff --git a/cmd/podman/umount.go b/cmd/podman/umount.go index 02bec551e..6d9009388 100644 --- a/cmd/podman/umount.go +++ b/cmd/podman/umount.go @@ -47,6 +47,7 @@ func init() { 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") flags.BoolVarP(&umountCommand.Latest, "latest", "l", false, "Act on the latest container podman is aware of") + markFlagHiddenForRemoteClient("latest", flags) } func umountCmd(c *cliconfig.UmountValues) error { diff --git a/cmd/podman/utils.go b/cmd/podman/utils.go index 88ac62304..0fbea417b 100644 --- a/cmd/podman/utils.go +++ b/cmd/podman/utils.go @@ -3,6 +3,7 @@ package main import ( "context" "fmt" + "github.com/spf13/pflag" "os" gosignal "os/signal" @@ -244,3 +245,11 @@ func printParallelOutput(m map[string]error, errCount int) error { } return lastError } + +// markFlagHiddenForRemoteClient makes the flag not appear as part of the CLI +// on the remote-client +func markFlagHiddenForRemoteClient(flagName string, flags *pflag.FlagSet) { + if remoteclient { + flags.MarkHidden(flagName) + } +} diff --git a/cmd/podman/wait.go b/cmd/podman/wait.go index c6e6240f3..9df7cdbae 100644 --- a/cmd/podman/wait.go +++ b/cmd/podman/wait.go @@ -40,6 +40,7 @@ func init() { 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") + markFlagHiddenForRemoteClient("latest", flags) } func waitCmd(c *cliconfig.WaitValues) error { |