aboutsummaryrefslogtreecommitdiff
path: root/cmd/podman/tag.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/tag.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/tag.go')
-rw-r--r--cmd/podman/tag.go34
1 files changed, 23 insertions, 11 deletions
diff --git a/cmd/podman/tag.go b/cmd/podman/tag.go
index d19cf69a2..2c7cf4abb 100644
--- a/cmd/podman/tag.go
+++ b/cmd/podman/tag.go
@@ -1,29 +1,41 @@
package main
import (
+ "github.com/containers/libpod/cmd/podman/cliconfig"
"github.com/containers/libpod/libpod/adapter"
"github.com/pkg/errors"
- "github.com/urfave/cli"
+ "github.com/spf13/cobra"
)
var (
+ tagCommand cliconfig.TagValues
+
tagDescription = "Adds one or more additional names to locally-stored image"
- tagCommand = cli.Command{
- Name: "tag",
- Usage: "Add an additional name to a local image",
- Description: tagDescription,
- Action: tagCmd,
- ArgsUsage: "IMAGE-NAME [IMAGE-NAME ...]",
- OnUsageError: usageErrorHandler,
+ _tagCommand = &cobra.Command{
+ Use: "tag",
+ Short: "Add an additional name to a local image",
+ Long: tagDescription,
+ RunE: func(cmd *cobra.Command, args []string) error {
+ tagCommand.InputArgs = args
+ tagCommand.GlobalFlags = MainGlobalOpts
+ return tagCmd(&tagCommand)
+ },
+ Example: "IMAGE-NAME [IMAGE-NAME ...]",
}
)
-func tagCmd(c *cli.Context) error {
- args := c.Args()
+func init() {
+ tagCommand.Command = _tagCommand
+ rootCmd.AddCommand(tagCommand.Command)
+
+}
+
+func tagCmd(c *cliconfig.TagValues) error {
+ args := c.InputArgs
if len(args) < 2 {
return errors.Errorf("image name and at least one new name must be specified")
}
- runtime, err := adapter.GetRuntime(c)
+ runtime, err := adapter.GetRuntime(&c.PodmanCommand)
if err != nil {
return errors.Wrapf(err, "could not create runtime")
}