aboutsummaryrefslogtreecommitdiff
path: root/cmd/podman/container.go
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2019-03-02 07:14:28 -0500
committerDaniel J Walsh <dwalsh@redhat.com>2019-03-03 06:14:20 -0500
commitd231cfba92ef440404f936a2cb0a64503b9c8c46 (patch)
tree716b5088d5f97ee85dc0adf19e43622044a41b5d /cmd/podman/container.go
parent4c618875f6402f36e4c820766050667e6a417d7c (diff)
downloadpodman-d231cfba92ef440404f936a2cb0a64503b9c8c46.tar.gz
podman-d231cfba92ef440404f936a2cb0a64503b9c8c46.tar.bz2
podman-d231cfba92ef440404f936a2cb0a64503b9c8c46.zip
Fix aliased commands to actually work
The current aliased commands podman container list and podman image list podman image rm Do not work properly. The global storage options are broken. This patch fixes this issue. Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'cmd/podman/container.go')
-rw-r--r--cmd/podman/container.go50
1 files changed, 36 insertions, 14 deletions
diff --git a/cmd/podman/container.go b/cmd/podman/container.go
index 338bb005c..65ec22317 100644
--- a/cmd/podman/container.go
+++ b/cmd/podman/container.go
@@ -1,27 +1,49 @@
package main
import (
+ "strings"
+
"github.com/containers/libpod/cmd/podman/cliconfig"
"github.com/spf13/cobra"
)
-var containerDescription = "Manage containers"
-var containerCommand = cliconfig.PodmanCommand{
- Command: &cobra.Command{
- Use: "container",
- Short: "Manage Containers",
- Long: containerDescription,
- TraverseChildren: true,
- },
-}
+var (
+ containerDescription = "Manage containers"
+ containerCommand = cliconfig.PodmanCommand{
+ Command: &cobra.Command{
+ Use: "container",
+ Short: "Manage Containers",
+ Long: containerDescription,
+ TraverseChildren: true,
+ },
+ }
-// Commands that are universally implemented.
-var containerCommands = []*cobra.Command{
- _containerExistsCommand,
- _inspectCommand,
-}
+ listSubCommand cliconfig.PsValues
+ _listSubCommand = &cobra.Command{
+ Use: strings.Replace(_psCommand.Use, "ps", "list", 1),
+ Short: _psCommand.Short,
+ Long: _psCommand.Long,
+ Aliases: []string{"ls"},
+ RunE: func(cmd *cobra.Command, args []string) error {
+ listSubCommand.InputArgs = args
+ listSubCommand.GlobalFlags = MainGlobalOpts
+ return psCmd(&listSubCommand)
+ },
+ Example: strings.Replace(_psCommand.Example, "podman ps", "podman container list", -1),
+ }
+
+ // Commands that are universally implemented.
+ containerCommands = []*cobra.Command{
+ _containerExistsCommand,
+ _inspectCommand,
+ _listSubCommand,
+ }
+)
func init() {
+ listSubCommand.Command = _listSubCommand
+ psInit(&listSubCommand)
+
containerCommand.AddCommand(containerCommands...)
containerCommand.AddCommand(getContainerSubCommands()...)
containerCommand.SetUsageTemplate(UsageTemplate())