Files
kopia/cli/command_manifest_rm.go
Jarek Kowalski 5e8e175cfa repo: refactored read/write methods of repo.Repository (#749)
Reader methods go to repo.Reader and write methods go to repo.Writer
Switched usage to new interfaces based on linter errors.
2021-01-04 21:33:12 -08:00

31 lines
677 B
Go

package cli
import (
"context"
"github.com/pkg/errors"
"github.com/kopia/kopia/repo"
)
var (
manifestRemoveCommand = manifestCommands.Command("rm", "Remove manifest items")
manifestRemoveItems = manifestRemoveCommand.Arg("item", "Items to remove").Required().Strings()
)
func runManifestRemoveCommand(ctx context.Context, rep repo.Writer) error {
advancedCommand(ctx)
for _, it := range toManifestIDs(*manifestRemoveItems) {
if err := rep.DeleteManifest(ctx, it); err != nil {
return errors.Wrapf(err, "unable to delete manifest %v", it)
}
}
return nil
}
func init() {
manifestRemoveCommand.Action(repositoryWriterAction(runManifestRemoveCommand))
}