diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2019-02-08 20:12:38 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-02-08 20:12:38 +0100 |
commit | afd4d5f4a4b05f421e6f336b4d74a0d808be57ed (patch) | |
tree | 2ccb4a0bd9bda70c1c258dcb1b8aca8961d9ad30 /cmd/podman/container.go | |
parent | 962850c6e0dfcee926af31fc0ad24f1f6c26f8ac (diff) | |
parent | 25a3923b61a5ca014318e6d957f68abd03947297 (diff) | |
download | podman-afd4d5f4a4b05f421e6f336b4d74a0d808be57ed.tar.gz podman-afd4d5f4a4b05f421e6f336b4d74a0d808be57ed.tar.bz2 podman-afd4d5f4a4b05f421e6f336b4d74a0d808be57ed.zip |
Merge pull request #2274 from baude/cobraprep
Migrate to cobra CLI
Diffstat (limited to 'cmd/podman/container.go')
-rw-r--r-- | cmd/podman/container.go | 37 |
1 files changed, 14 insertions, 23 deletions
diff --git a/cmd/podman/container.go b/cmd/podman/container.go index 29300a6a4..969cb2dc8 100644 --- a/cmd/podman/container.go +++ b/cmd/podman/container.go @@ -1,30 +1,21 @@ package main import ( - "sort" - - "github.com/urfave/cli" + "github.com/containers/libpod/cmd/podman/cliconfig" + "github.com/spf13/cobra" ) -var ( - containerSubCommands = []cli.Command{ - exportCommand, - inspectCommand, - } - containerDescription = "Manage containers" - containerCommand = cli.Command{ - Name: "container", - Usage: "Manage Containers", - Description: containerDescription, - ArgsUsage: "", - Subcommands: getContainerSubCommandsSorted(), - UseShortOptionHandling: true, - OnUsageError: usageErrorHandler, - } -) +var containerDescription = "Manage containers" +var containerCommand = cliconfig.PodmanCommand{ + Command: &cobra.Command{ + Use: "container", + Short: "Manage Containers", + Long: containerDescription, + TraverseChildren: true, + }, +} -func getContainerSubCommandsSorted() []cli.Command { - containerSubCommands = append(containerSubCommands, getContainerSubCommands()...) - sort.Sort(commandSortedAlpha{containerSubCommands}) - return containerSubCommands +func init() { + containerCommand.AddCommand(getContainerSubCommands()...) + rootCmd.AddCommand(containerCommand.Command) } |