summaryrefslogtreecommitdiff
path: root/cmd/podman/pods
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/podman/pods')
-rw-r--r--cmd/podman/pods/create.go68
-rw-r--r--cmd/podman/pods/exists.go12
-rw-r--r--cmd/podman/pods/inspect.go18
-rw-r--r--cmd/podman/pods/kill.go8
-rw-r--r--cmd/podman/pods/pause.go2
-rw-r--r--cmd/podman/pods/prune.go14
-rw-r--r--cmd/podman/pods/ps.go33
-rw-r--r--cmd/podman/pods/restart.go2
-rw-r--r--cmd/podman/pods/rm.go8
-rw-r--r--cmd/podman/pods/start.go8
-rw-r--r--cmd/podman/pods/stats.go16
-rw-r--r--cmd/podman/pods/stop.go13
-rw-r--r--cmd/podman/pods/top.go12
-rw-r--r--cmd/podman/pods/unpause.go4
14 files changed, 161 insertions, 57 deletions
diff --git a/cmd/podman/pods/create.go b/cmd/podman/pods/create.go
index efa84dcb4..d33455e81 100644
--- a/cmd/podman/pods/create.go
+++ b/cmd/podman/pods/create.go
@@ -7,6 +7,7 @@ import (
"os"
"strings"
+ "github.com/containers/common/pkg/completion"
"github.com/containers/podman/v2/cmd/podman/common"
"github.com/containers/podman/v2/cmd/podman/parse"
"github.com/containers/podman/v2/cmd/podman/registry"
@@ -27,11 +28,12 @@ var (
You can then start it at any time with the podman pod start <pod_id> command. The pod will be created with the initial state 'created'.`
createCommand = &cobra.Command{
- Use: "create [options]",
- Args: validate.NoArgs,
- Short: "Create a new empty pod",
- Long: podCreateDescription,
- RunE: create,
+ Use: "create [options]",
+ Args: validate.NoArgs,
+ Short: "Create a new empty pod",
+ Long: podCreateDescription,
+ RunE: create,
+ ValidArgsFunction: completion.AutocompleteNone,
}
)
@@ -51,19 +53,53 @@ func init() {
})
flags := createCommand.Flags()
flags.SetInterspersed(false)
- flags.AddFlagSet(common.GetNetFlags())
- flags.StringVar(&createOptions.CGroupParent, "cgroup-parent", "", "Set parent cgroup for the pod")
+
+ common.DefineNetFlags(createCommand)
+
+ cgroupParentflagName := "cgroup-parent"
+ flags.StringVar(&createOptions.CGroupParent, cgroupParentflagName, "", "Set parent cgroup for the pod")
+ _ = createCommand.RegisterFlagCompletionFunc(cgroupParentflagName, completion.AutocompleteDefault)
+
flags.BoolVar(&createOptions.Infra, "infra", true, "Create an infra container associated with the pod to share namespaces with")
- flags.StringVar(&createOptions.InfraConmonPidFile, "infra-conmon-pidfile", "", "Path to the file that will receive the POD of the infra container's conmon")
- flags.String("infra-image", containerConfig.Engine.InfraImage, "The image of the infra container to associate with the pod")
- flags.String("infra-command", containerConfig.Engine.InfraCommand, "The command to run on the infra container when the pod is started")
- flags.StringSliceVar(&labelFile, "label-file", []string{}, "Read in a line delimited file of labels")
- flags.StringSliceVarP(&labels, "label", "l", []string{}, "Set metadata on pod (default [])")
- flags.StringVarP(&createOptions.Name, "name", "n", "", "Assign a name to the pod")
- flags.StringVarP(&createOptions.Hostname, "hostname", "", "", "Set a hostname to the pod")
- flags.StringVar(&podIDFile, "pod-id-file", "", "Write the pod ID to the file")
+
+ infraConmonPidfileFlagName := "infra-conmon-pidfile"
+ flags.StringVar(&createOptions.InfraConmonPidFile, infraConmonPidfileFlagName, "", "Path to the file that will receive the POD of the infra container's conmon")
+ _ = createCommand.RegisterFlagCompletionFunc(infraConmonPidfileFlagName, completion.AutocompleteDefault)
+
+ infraImageFlagName := "infra-image"
+ flags.String(infraImageFlagName, containerConfig.Engine.InfraImage, "The image of the infra container to associate with the pod")
+ _ = createCommand.RegisterFlagCompletionFunc(infraImageFlagName, common.AutocompleteImages)
+
+ infraCommandFlagName := "infra-command"
+ flags.String(infraCommandFlagName, containerConfig.Engine.InfraCommand, "The command to run on the infra container when the pod is started")
+ _ = createCommand.RegisterFlagCompletionFunc(infraCommandFlagName, completion.AutocompleteNone)
+
+ labelFileFlagName := "label-file"
+ flags.StringSliceVar(&labelFile, labelFileFlagName, []string{}, "Read in a line delimited file of labels")
+ _ = createCommand.RegisterFlagCompletionFunc(labelFileFlagName, completion.AutocompleteDefault)
+
+ labelFlagName := "label"
+ flags.StringSliceVarP(&labels, labelFlagName, "l", []string{}, "Set metadata on pod (default [])")
+ _ = createCommand.RegisterFlagCompletionFunc(labelFlagName, completion.AutocompleteNone)
+
+ nameFlagName := "name"
+ flags.StringVarP(&createOptions.Name, nameFlagName, "n", "", "Assign a name to the pod")
+ _ = createCommand.RegisterFlagCompletionFunc(nameFlagName, completion.AutocompleteNone)
+
+ hostnameFlagName := "hostname"
+ flags.StringVarP(&createOptions.Hostname, hostnameFlagName, "", "", "Set a hostname to the pod")
+ _ = createCommand.RegisterFlagCompletionFunc(hostnameFlagName, completion.AutocompleteNone)
+
+ podIDFileFlagName := "pod-id-file"
+ flags.StringVar(&podIDFile, podIDFileFlagName, "", "Write the pod ID to the file")
+ _ = createCommand.RegisterFlagCompletionFunc(podIDFileFlagName, completion.AutocompleteDefault)
+
flags.BoolVar(&replace, "replace", false, "If a pod with the same exists, replace it")
- flags.StringVar(&share, "share", specgen.DefaultKernelNamespaces, "A comma delimited list of kernel namespaces the pod will share")
+
+ shareFlagName := "share"
+ flags.StringVar(&share, shareFlagName, specgen.DefaultKernelNamespaces, "A comma delimited list of kernel namespaces the pod will share")
+ _ = createCommand.RegisterFlagCompletionFunc(shareFlagName, common.AutocompletePodShareNamespace)
+
flags.SetNormalizeFunc(aliasNetworkFlag)
}
diff --git a/cmd/podman/pods/exists.go b/cmd/podman/pods/exists.go
index cdaf2a707..a5c45803e 100644
--- a/cmd/podman/pods/exists.go
+++ b/cmd/podman/pods/exists.go
@@ -3,6 +3,7 @@ package pods
import (
"context"
+ "github.com/containers/podman/v2/cmd/podman/common"
"github.com/containers/podman/v2/cmd/podman/registry"
"github.com/containers/podman/v2/pkg/domain/entities"
"github.com/spf13/cobra"
@@ -12,11 +13,12 @@ var (
podExistsDescription = `If the named pod exists in local storage, podman pod exists exits with 0, otherwise the exit code will be 1.`
existsCommand = &cobra.Command{
- Use: "exists POD",
- Short: "Check if a pod exists in local storage",
- Long: podExistsDescription,
- RunE: exists,
- Args: cobra.ExactArgs(1),
+ Use: "exists POD",
+ Short: "Check if a pod exists in local storage",
+ Long: podExistsDescription,
+ RunE: exists,
+ Args: cobra.ExactArgs(1),
+ ValidArgsFunction: common.AutocompletePods,
Example: `podman pod exists podID
podman pod exists mypod || podman pod create --name mypod`,
DisableFlagsInUseLine: true,
diff --git a/cmd/podman/pods/inspect.go b/cmd/podman/pods/inspect.go
index 7f81ba8fb..091094ff6 100644
--- a/cmd/podman/pods/inspect.go
+++ b/cmd/podman/pods/inspect.go
@@ -8,6 +8,7 @@ import (
"text/template"
"github.com/containers/common/pkg/report"
+ "github.com/containers/podman/v2/cmd/podman/common"
"github.com/containers/podman/v2/cmd/podman/registry"
"github.com/containers/podman/v2/cmd/podman/validate"
"github.com/containers/podman/v2/pkg/domain/entities"
@@ -25,11 +26,12 @@ var (
By default, this will render all results in a JSON array.`)
inspectCmd = &cobra.Command{
- Use: "inspect [options] POD [POD...]",
- Short: "Displays a pod configuration",
- Long: inspectDescription,
- RunE: inspect,
- Example: `podman pod inspect podID`,
+ Use: "inspect [options] POD [POD...]",
+ Short: "Displays a pod configuration",
+ Long: inspectDescription,
+ RunE: inspect,
+ ValidArgsFunction: common.AutocompletePods,
+ Example: `podman pod inspect podID`,
}
)
@@ -40,7 +42,11 @@ func init() {
Parent: podCmd,
})
flags := inspectCmd.Flags()
- flags.StringVarP(&inspectOptions.Format, "format", "f", "json", "Format the output to a Go template or json")
+
+ formatFlagName := "format"
+ flags.StringVarP(&inspectOptions.Format, formatFlagName, "f", "json", "Format the output to a Go template or json")
+ _ = inspectCmd.RegisterFlagCompletionFunc(formatFlagName, common.AutocompleteJSONFormat)
+
validate.AddLatestFlag(inspectCmd, &inspectOptions.Latest)
}
diff --git a/cmd/podman/pods/kill.go b/cmd/podman/pods/kill.go
index 1902a2c80..be8fd31df 100644
--- a/cmd/podman/pods/kill.go
+++ b/cmd/podman/pods/kill.go
@@ -4,6 +4,7 @@ import (
"context"
"fmt"
+ "github.com/containers/podman/v2/cmd/podman/common"
"github.com/containers/podman/v2/cmd/podman/registry"
"github.com/containers/podman/v2/cmd/podman/utils"
"github.com/containers/podman/v2/cmd/podman/validate"
@@ -23,6 +24,7 @@ var (
Args: func(cmd *cobra.Command, args []string) error {
return validate.CheckAllLatestAndCIDFile(cmd, args, false, false)
},
+ ValidArgsFunction: common.AutocompletePodsRunning,
Example: `podman pod kill podID
podman pod kill --signal TERM mywebserver
podman pod kill --latest`,
@@ -41,7 +43,11 @@ func init() {
})
flags := killCommand.Flags()
flags.BoolVarP(&killOpts.All, "all", "a", false, "Kill all containers in all pods")
- flags.StringVarP(&killOpts.Signal, "signal", "s", "KILL", "Signal to send to the containers in the pod")
+
+ signalFlagName := "signal"
+ flags.StringVarP(&killOpts.Signal, signalFlagName, "s", "KILL", "Signal to send to the containers in the pod")
+ _ = killCommand.RegisterFlagCompletionFunc(signalFlagName, common.AutocompleteStopSignal)
+
validate.AddLatestFlag(killCommand, &killOpts.Latest)
}
diff --git a/cmd/podman/pods/pause.go b/cmd/podman/pods/pause.go
index bba26f90d..108893173 100644
--- a/cmd/podman/pods/pause.go
+++ b/cmd/podman/pods/pause.go
@@ -4,6 +4,7 @@ import (
"context"
"fmt"
+ "github.com/containers/podman/v2/cmd/podman/common"
"github.com/containers/podman/v2/cmd/podman/registry"
"github.com/containers/podman/v2/cmd/podman/utils"
"github.com/containers/podman/v2/cmd/podman/validate"
@@ -23,6 +24,7 @@ var (
Args: func(cmd *cobra.Command, args []string) error {
return validate.CheckAllLatestAndCIDFile(cmd, args, false, false)
},
+ ValidArgsFunction: common.AutocompletePodsRunning,
Example: `podman pod pause podID1 podID2
podman pod pause --latest
podman pod pause --all`,
diff --git a/cmd/podman/pods/prune.go b/cmd/podman/pods/prune.go
index e3eae3f71..626ef2895 100644
--- a/cmd/podman/pods/prune.go
+++ b/cmd/podman/pods/prune.go
@@ -7,6 +7,7 @@ import (
"os"
"strings"
+ "github.com/containers/podman/v2/cmd/podman/common"
"github.com/containers/podman/v2/cmd/podman/registry"
"github.com/containers/podman/v2/cmd/podman/utils"
"github.com/containers/podman/v2/cmd/podman/validate"
@@ -23,12 +24,13 @@ var (
pruneDescription = fmt.Sprintf(`podman pod prune Removes all exited pods`)
pruneCommand = &cobra.Command{
- Use: "prune [options]",
- Args: validate.NoArgs,
- Short: "Remove all stopped pods and their containers",
- Long: pruneDescription,
- RunE: prune,
- Example: `podman pod prune`,
+ Use: "prune [options]",
+ Args: validate.NoArgs,
+ Short: "Remove all stopped pods and their containers",
+ Long: pruneDescription,
+ RunE: prune,
+ ValidArgsFunction: common.AutocompletePods,
+ Example: `podman pod prune`,
}
)
diff --git a/cmd/podman/pods/ps.go b/cmd/podman/pods/ps.go
index 40fc71780..51c2e92f0 100644
--- a/cmd/podman/pods/ps.go
+++ b/cmd/podman/pods/ps.go
@@ -10,7 +10,9 @@ import (
"text/template"
"time"
+ "github.com/containers/common/pkg/completion"
"github.com/containers/common/pkg/report"
+ "github.com/containers/podman/v2/cmd/podman/common"
"github.com/containers/podman/v2/cmd/podman/parse"
"github.com/containers/podman/v2/cmd/podman/registry"
"github.com/containers/podman/v2/cmd/podman/validate"
@@ -25,12 +27,13 @@ var (
// Command: podman pod _ps_
psCmd = &cobra.Command{
- Use: "ps [options]",
- Aliases: []string{"ls", "list"},
- Short: "List pods",
- Long: psDescription,
- RunE: pods,
- Args: validate.NoArgs,
+ Use: "ps [options]",
+ Aliases: []string{"ls", "list"},
+ Short: "List pods",
+ Long: psDescription,
+ RunE: pods,
+ Args: validate.NoArgs,
+ ValidArgsFunction: completion.AutocompleteNone,
}
)
@@ -51,13 +54,25 @@ func init() {
flags.BoolVar(&psInput.CtrIds, "ctr-ids", false, "Display the container UUIDs. If no-trunc is not set they will be truncated")
flags.BoolVar(&psInput.CtrStatus, "ctr-status", false, "Display the container status")
// TODO should we make this a [] ?
- flags.StringSliceVarP(&inputFilters, "filter", "f", []string{}, "Filter output based on conditions given")
- flags.StringVar(&psInput.Format, "format", "", "Pretty-print pods to JSON or using a Go template")
+
+ filterFlagName := "filter"
+ flags.StringSliceVarP(&inputFilters, filterFlagName, "f", []string{}, "Filter output based on conditions given")
+ //TODO complete filters
+ _ = psCmd.RegisterFlagCompletionFunc(filterFlagName, completion.AutocompleteNone)
+
+ formatFlagName := "format"
+ flags.StringVar(&psInput.Format, formatFlagName, "", "Pretty-print pods to JSON or using a Go template")
+ _ = psCmd.RegisterFlagCompletionFunc(formatFlagName, common.AutocompleteJSONFormat)
+
flags.BoolVar(&psInput.Namespace, "namespace", false, "Display namespace information of the pod")
flags.BoolVar(&psInput.Namespace, "ns", false, "Display namespace information of the pod")
flags.BoolVar(&noTrunc, "no-trunc", false, "Do not truncate pod and container IDs")
flags.BoolVarP(&psInput.Quiet, "quiet", "q", false, "Print the numeric IDs of the pods only")
- flags.StringVar(&psInput.Sort, "sort", "created", "Sort output by created, id, name, or number")
+
+ sortFlagName := "sort"
+ flags.StringVar(&psInput.Sort, sortFlagName, "created", "Sort output by created, id, name, or number")
+ _ = psCmd.RegisterFlagCompletionFunc(sortFlagName, common.AutocompletePodPsSort)
+
validate.AddLatestFlag(psCmd, &psInput.Latest)
}
diff --git a/cmd/podman/pods/restart.go b/cmd/podman/pods/restart.go
index 119b4ddee..7a4b28a45 100644
--- a/cmd/podman/pods/restart.go
+++ b/cmd/podman/pods/restart.go
@@ -4,6 +4,7 @@ import (
"context"
"fmt"
+ "github.com/containers/podman/v2/cmd/podman/common"
"github.com/containers/podman/v2/cmd/podman/registry"
"github.com/containers/podman/v2/cmd/podman/utils"
"github.com/containers/podman/v2/cmd/podman/validate"
@@ -23,6 +24,7 @@ var (
Args: func(cmd *cobra.Command, args []string) error {
return validate.CheckAllLatestAndCIDFile(cmd, args, false, false)
},
+ ValidArgsFunction: common.AutocompletePods,
Example: `podman pod restart podID1 podID2
podman pod restart --latest
podman pod restart --all`,
diff --git a/cmd/podman/pods/rm.go b/cmd/podman/pods/rm.go
index 714e075e2..ff238aa20 100644
--- a/cmd/podman/pods/rm.go
+++ b/cmd/podman/pods/rm.go
@@ -5,6 +5,7 @@ import (
"fmt"
"strings"
+ "github.com/containers/common/pkg/completion"
"github.com/containers/podman/v2/cmd/podman/common"
"github.com/containers/podman/v2/cmd/podman/registry"
"github.com/containers/podman/v2/cmd/podman/utils"
@@ -35,6 +36,7 @@ var (
Args: func(cmd *cobra.Command, args []string) error {
return validate.CheckAllLatestAndPodIDFile(cmd, args, false, true)
},
+ ValidArgsFunction: common.AutocompletePods,
Example: `podman pod rm mywebserverpod
podman pod rm -f 860a4b23
podman pod rm -f -a`,
@@ -52,7 +54,11 @@ func init() {
flags.BoolVarP(&rmOptions.All, "all", "a", false, "Remove all running pods")
flags.BoolVarP(&rmOptions.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(&rmOptions.Ignore, "ignore", "i", false, "Ignore errors when a specified pod is missing")
- flags.StringArrayVarP(&rmOptions.PodIDFiles, "pod-id-file", "", nil, "Read the pod ID from the file")
+
+ podIDFileFlagName := "pod-id-file"
+ flags.StringArrayVarP(&rmOptions.PodIDFiles, podIDFileFlagName, "", nil, "Read the pod ID from the file")
+ _ = rmCommand.RegisterFlagCompletionFunc(podIDFileFlagName, completion.AutocompleteDefault)
+
validate.AddLatestFlag(rmCommand, &rmOptions.Latest)
if registry.IsRemote() {
diff --git a/cmd/podman/pods/start.go b/cmd/podman/pods/start.go
index 28ee4769a..7cd5c64d9 100644
--- a/cmd/podman/pods/start.go
+++ b/cmd/podman/pods/start.go
@@ -4,6 +4,7 @@ import (
"context"
"fmt"
+ "github.com/containers/common/pkg/completion"
"github.com/containers/podman/v2/cmd/podman/common"
"github.com/containers/podman/v2/cmd/podman/registry"
"github.com/containers/podman/v2/cmd/podman/utils"
@@ -31,6 +32,7 @@ var (
Args: func(cmd *cobra.Command, args []string) error {
return validate.CheckAllLatestAndPodIDFile(cmd, args, false, true)
},
+ ValidArgsFunction: common.AutocompletePods,
Example: `podman pod start podID
podman pod start --latest
podman pod start --all`,
@@ -50,7 +52,11 @@ func init() {
flags := startCommand.Flags()
flags.BoolVarP(&startOptions.All, "all", "a", false, "Restart all running pods")
- flags.StringArrayVarP(&startOptions.PodIDFiles, "pod-id-file", "", nil, "Read the pod ID from the file")
+
+ podIDFileFlagName := "pod-id-file"
+ flags.StringArrayVarP(&startOptions.PodIDFiles, podIDFileFlagName, "", nil, "Read the pod ID from the file")
+ _ = startCommand.RegisterFlagCompletionFunc(podIDFileFlagName, completion.AutocompleteDefault)
+
validate.AddLatestFlag(startCommand, &startOptions.Latest)
}
diff --git a/cmd/podman/pods/stats.go b/cmd/podman/pods/stats.go
index c5d1e7f07..79e7cd8ed 100644
--- a/cmd/podman/pods/stats.go
+++ b/cmd/podman/pods/stats.go
@@ -10,6 +10,7 @@ import (
"github.com/buger/goterm"
"github.com/containers/common/pkg/report"
+ "github.com/containers/podman/v2/cmd/podman/common"
"github.com/containers/podman/v2/cmd/podman/parse"
"github.com/containers/podman/v2/cmd/podman/registry"
"github.com/containers/podman/v2/cmd/podman/validate"
@@ -33,10 +34,11 @@ var (
statsDescription = `Display the containers' resource-usage statistics of one or more running pod`
// Command: podman pod _pod_
statsCmd = &cobra.Command{
- Use: "stats [options] [POD...]",
- Short: "Display a live stream of resource usage statistics for the containers in one or more pods",
- Long: statsDescription,
- RunE: stats,
+ Use: "stats [options] [POD...]",
+ Short: "Display a live stream of resource usage statistics for the containers in one or more pods",
+ Long: statsDescription,
+ RunE: stats,
+ ValidArgsFunction: common.AutocompletePodsRunning,
Example: `podman pod stats
podman pod stats a69b23034235 named-pod
podman pod stats --latest
@@ -53,7 +55,11 @@ func init() {
flags := statsCmd.Flags()
flags.BoolVarP(&statsOptions.All, "all", "a", false, "Provide stats for all pods")
- flags.StringVar(&statsOptions.Format, "format", "", "Pretty-print container statistics to JSON or using a Go template")
+
+ formatFlagName := "format"
+ flags.StringVar(&statsOptions.Format, formatFlagName, "", "Pretty-print container statistics to JSON or using a Go template")
+ _ = statsCmd.RegisterFlagCompletionFunc(formatFlagName, common.AutocompleteJSONFormat)
+
flags.BoolVar(&statsOptions.NoReset, "no-reset", false, "Disable resetting the screen when streaming")
flags.BoolVar(&statsOptions.NoStream, "no-stream", false, "Disable streaming stats and only pull the first result")
validate.AddLatestFlag(statsCmd, &statsOptions.Latest)
diff --git a/cmd/podman/pods/stop.go b/cmd/podman/pods/stop.go
index a2a9b0b57..d03364028 100644
--- a/cmd/podman/pods/stop.go
+++ b/cmd/podman/pods/stop.go
@@ -4,6 +4,7 @@ import (
"context"
"fmt"
+ "github.com/containers/common/pkg/completion"
"github.com/containers/podman/v2/cmd/podman/common"
"github.com/containers/podman/v2/cmd/podman/registry"
"github.com/containers/podman/v2/cmd/podman/utils"
@@ -36,6 +37,7 @@ var (
Args: func(cmd *cobra.Command, args []string) error {
return validate.CheckAllLatestAndPodIDFile(cmd, args, false, true)
},
+ ValidArgsFunction: common.AutocompletePodsRunning,
Example: `podman pod stop mywebserverpod
podman pod stop --latest
podman pod stop --time 0 490eb 3557fb`,
@@ -51,8 +53,15 @@ func init() {
flags := stopCommand.Flags()
flags.BoolVarP(&stopOptions.All, "all", "a", false, "Stop all running pods")
flags.BoolVarP(&stopOptions.Ignore, "ignore", "i", false, "Ignore errors when a specified pod is missing")
- flags.UintVarP(&stopOptions.TimeoutCLI, "time", "t", containerConfig.Engine.StopTimeout, "Seconds to wait for pod stop before killing the container")
- flags.StringArrayVarP(&stopOptions.PodIDFiles, "pod-id-file", "", nil, "Read the pod ID from the file")
+
+ timeFlagName := "time"
+ flags.UintVarP(&stopOptions.TimeoutCLI, timeFlagName, "t", containerConfig.Engine.StopTimeout, "Seconds to wait for pod stop before killing the container")
+ _ = stopCommand.RegisterFlagCompletionFunc(timeFlagName, completion.AutocompleteNone)
+
+ podIDFileFlagName := "pod-id-file"
+ flags.StringArrayVarP(&stopOptions.PodIDFiles, podIDFileFlagName, "", nil, "Write the pod ID to the file")
+ _ = stopCommand.RegisterFlagCompletionFunc(podIDFileFlagName, completion.AutocompleteDefault)
+
validate.AddLatestFlag(stopCommand, &stopOptions.Latest)
if registry.IsRemote() {
diff --git a/cmd/podman/pods/top.go b/cmd/podman/pods/top.go
index 0ffa724da..45ef1e7c2 100644
--- a/cmd/podman/pods/top.go
+++ b/cmd/podman/pods/top.go
@@ -7,6 +7,7 @@ import (
"strings"
"text/tabwriter"
+ "github.com/containers/podman/v2/cmd/podman/common"
"github.com/containers/podman/v2/cmd/podman/registry"
"github.com/containers/podman/v2/cmd/podman/validate"
"github.com/containers/podman/v2/pkg/domain/entities"
@@ -23,11 +24,12 @@ var (
topOptions = entities.PodTopOptions{}
topCommand = &cobra.Command{
- Use: "top [options] POD [FORMAT-DESCRIPTORS|ARGS...]",
- Short: "Display the running processes of containers in a pod",
- Long: topDescription,
- RunE: top,
- Args: cobra.ArbitraryArgs,
+ Use: "top [options] POD [FORMAT-DESCRIPTORS|ARGS...]",
+ Short: "Display the running processes of containers in a pod",
+ Long: topDescription,
+ RunE: top,
+ Args: cobra.ArbitraryArgs,
+ ValidArgsFunction: common.AutocompletePodsRunning,
Example: `podman pod top podID
podman pod top --latest
podman pod top podID pid seccomp args %C
diff --git a/cmd/podman/pods/unpause.go b/cmd/podman/pods/unpause.go
index 15b30db14..499faec37 100644
--- a/cmd/podman/pods/unpause.go
+++ b/cmd/podman/pods/unpause.go
@@ -4,6 +4,7 @@ import (
"context"
"fmt"
+ "github.com/containers/podman/v2/cmd/podman/common"
"github.com/containers/podman/v2/cmd/podman/registry"
"github.com/containers/podman/v2/cmd/podman/utils"
"github.com/containers/podman/v2/cmd/podman/validate"
@@ -23,6 +24,9 @@ var (
Args: func(cmd *cobra.Command, args []string) error {
return validate.CheckAllLatestAndCIDFile(cmd, args, false, false)
},
+ // TODO have a function which shows only pods which could be unpaused
+ // for now show all
+ ValidArgsFunction: common.AutocompletePods,
Example: `podman pod unpause podID1 podID2
podman pod unpause --all
podman pod unpause --latest`,