spiegel_podman/cmd/podman/manifest/remove.go
Valentin Rothberg bd09b7aa79 bump go module to version 4
Automated for .go files via gomove [1]:
`gomove github.com/containers/podman/v3 github.com/containers/podman/v4`

Remaining files via vgrep [2]:
`vgrep github.com/containers/podman/v3`

[1] https://github.com/KSubedi/gomove
[2] https://github.com/vrothberg/vgrep

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2022-01-18 12:47:07 +01:00

38 lines
1.1 KiB
Go

package manifest
import (
"fmt"
"github.com/containers/podman/v4/cmd/podman/common"
"github.com/containers/podman/v4/cmd/podman/registry"
"github.com/pkg/errors"
"github.com/spf13/cobra"
)
var (
removeCmd = &cobra.Command{
Use: "remove LIST IMAGE",
Short: "Remove an entry from a manifest list or image index",
Long: "Removes an image from a manifest list or image index.",
RunE: remove,
Args: cobra.ExactArgs(2),
ValidArgsFunction: common.AutocompleteImages,
Example: `podman manifest remove mylist:v1.11 sha256:15352d97781ffdf357bf3459c037be3efac4133dc9070c2dce7eca7c05c3e736`,
}
)
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
Command: removeCmd,
Parent: manifestCmd,
})
}
func remove(cmd *cobra.Command, args []string) error {
updatedListID, err := registry.ImageEngine().ManifestRemoveDigest(registry.Context(), args[0], args[1])
if err != nil {
return errors.Wrapf(err, "error removing from manifest list %s", args[0])
}
fmt.Println(updatedListID)
return nil
}