spiegel_podman/cmd/podman/manifest/remove.go
Paul Holzinger 5c1ed12d8d
enable gofumpt formatter
Based on our discussion gofumpt won the vote so use that one via
golangci-lint.

https://github.com/containers/podman/discussions/27291

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-11-11 12:32:46 +01:00

35 lines
1.1 KiB
Go

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