github.com/containers/libpod@v1.9.4-0.20220419124438-4284fd425507/cmd/podmanV2/images/untag.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  	untagCommand = &cobra.Command{
    11  		Use:   "untag [flags] IMAGE [NAME...]",
    12  		Short: "Remove a name from a local image",
    13  		Long:  "Removes one or more names from a locally-stored image.",
    14  		RunE:  untag,
    15  		Args:  cobra.MinimumNArgs(1),
    16  		Example: `podman untag 0e3bbc2
    17    podman untag imageID:latest otherImageName:latest
    18    podman untag httpd myregistryhost:5000/fedora/httpd:v2`,
    19  	}
    20  )
    21  
    22  func init() {
    23  	registry.Commands = append(registry.Commands, registry.CliCommand{
    24  		Mode:    []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
    25  		Command: untagCommand,
    26  	})
    27  	untagCommand.SetHelpTemplate(registry.HelpTemplate())
    28  	untagCommand.SetUsageTemplate(registry.UsageTemplate())
    29  }
    30  
    31  func untag(cmd *cobra.Command, args []string) error {
    32  	return registry.ImageEngine().Untag(registry.GetContext(), args[0], args[1:], entities.ImageUntagOptions{})
    33  }