mirror of
https://github.com/kopia/kopia.git
synced 2026-01-28 00:08:04 -05:00
31 lines
719 B
Go
31 lines
719 B
Go
package cli
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/pkg/errors"
|
|
|
|
"github.com/kopia/kopia/repo"
|
|
)
|
|
|
|
var (
|
|
manifestRemoveCommand = manifestCommands.Command("delete", "Remove manifest items").Alias("remove").Alias("rm")
|
|
manifestRemoveItems = manifestRemoveCommand.Arg("item", "Items to remove").Required().Strings()
|
|
)
|
|
|
|
func runManifestRemoveCommand(ctx context.Context, rep repo.RepositoryWriter) 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))
|
|
}
|