github.com/containers/libpod@v1.9.4-0.20220419124438-4284fd425507/cmd/podmanV2/images/tag.go (about) 1 package images 2 3 import ( 4 "github.com/containers/libpod/cmd/podmanV2/registry" 5 "github.com/containers/libpod/pkg/domain/entities" 6 "github.com/spf13/cobra" 7 ) 8 9 var ( 10 tagDescription = "Adds one or more additional names to locally-stored image." 11 tagCommand = &cobra.Command{ 12 Use: "tag [flags] IMAGE TARGET_NAME [TARGET_NAME...]", 13 Short: "Add an additional name to a local image", 14 Long: tagDescription, 15 RunE: tag, 16 PreRunE: preRunE, 17 Args: cobra.MinimumNArgs(2), 18 Example: `podman tag 0e3bbc2 fedora:latest 19 podman tag imageID:latest myNewImage:newTag 20 podman tag httpd myregistryhost:5000/fedora/httpd:v2`, 21 } 22 ) 23 24 func init() { 25 registry.Commands = append(registry.Commands, registry.CliCommand{ 26 Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode}, 27 Command: tagCommand, 28 }) 29 tagCommand.SetHelpTemplate(registry.HelpTemplate()) 30 tagCommand.SetUsageTemplate(registry.UsageTemplate()) 31 } 32 33 func tag(cmd *cobra.Command, args []string) error { 34 return registry.ImageEngine().Tag(registry.GetContext(), args[0], args[1:], entities.ImageTagOptions{}) 35 }