summaryrefslogtreecommitdiff
path: root/cmd/podman/image.go
diff options
context:
space:
mode:
authorbaude <bbaude@redhat.com>2019-01-31 13:20:04 -0600
committerbaude <bbaude@redhat.com>2019-02-08 10:26:43 -0600
commit25a3923b61a5ca014318e6d957f68abd03947297 (patch)
tree2ccb4a0bd9bda70c1c258dcb1b8aca8961d9ad30 /cmd/podman/image.go
parent962850c6e0dfcee926af31fc0ad24f1f6c26f8ac (diff)
downloadpodman-25a3923b61a5ca014318e6d957f68abd03947297.tar.gz
podman-25a3923b61a5ca014318e6d957f68abd03947297.tar.bz2
podman-25a3923b61a5ca014318e6d957f68abd03947297.zip
Migrate to cobra CLI
We intend to migrate to the cobra cli from urfave/cli because the project is more well maintained. There are also some technical reasons as well which extend into our remote client work. Signed-off-by: baude <bbaude@redhat.com>
Diffstat (limited to 'cmd/podman/image.go')
-rw-r--r--cmd/podman/image.go50
1 files changed, 24 insertions, 26 deletions
diff --git a/cmd/podman/image.go b/cmd/podman/image.go
index 6b451a1ca..ac7ff4944 100644
--- a/cmd/podman/image.go
+++ b/cmd/podman/image.go
@@ -1,37 +1,35 @@
package main
import (
- "sort"
-
- "github.com/urfave/cli"
+ "github.com/containers/libpod/cmd/podman/cliconfig"
+ "github.com/spf13/cobra"
)
var (
- imageSubCommands = []cli.Command{
- importCommand,
- historyCommand,
- imageExistsCommand,
- inspectCommand,
- lsImagesCommand,
- pruneImagesCommand,
- pullCommand,
- rmImageCommand,
- tagCommand,
- }
imageDescription = "Manage images"
- imageCommand = cli.Command{
- Name: "image",
- Usage: "Manage images",
- Description: imageDescription,
- ArgsUsage: "",
- Subcommands: getImageSubCommandsSorted(),
- UseShortOptionHandling: true,
- OnUsageError: usageErrorHandler,
+ imageCommand = cliconfig.PodmanCommand{
+ Command: &cobra.Command{
+ Use: "image",
+ Short: "Manage images",
+ Long: imageDescription,
+ },
}
)
-func getImageSubCommandsSorted() []cli.Command {
- imageSubCommands = append(imageSubCommands, getImageSubCommands()...)
- sort.Sort(commandSortedAlpha{imageSubCommands})
- return imageSubCommands
+//imageSubCommands are implemented both in local and remote clients
+var imageSubCommands = []*cobra.Command{
+ _historyCommand,
+ _imageExistsCommand,
+ _inspectCommand,
+ _imagesCommand,
+ _pruneImagesCommand,
+ _pushCommand,
+ _rmiCommand,
+ _tagCommand,
+}
+
+func init() {
+ imageCommand.AddCommand(imageSubCommands...)
+ imageCommand.AddCommand(getImageSubCommands()...)
+ rootCmd.AddCommand(imageCommand.Command)
}