Files
kopia/cli/command_blob_delete.go
Jarek Kowalski 54edb97b3a refactoring: renamed repo/block to repo/content
Also introduced strongly typed content.ID and manifest.ID (instead of string)

This aligns identifiers across all layers of repository:

blob.ID
content.ID
object.ID
manifest.ID
2019-06-01 22:24:19 -07:00

31 lines
643 B
Go

package cli
import (
"context"
"github.com/pkg/errors"
"github.com/kopia/kopia/repo"
"github.com/kopia/kopia/repo/blob"
)
var (
blobDeleteCommand = blobCommands.Command("delete", "Show contents of blobs").Alias("rm")
blobDeleteBlobIDs = blobDeleteCommand.Arg("blobIDs", "Blob IDs").Required().Strings()
)
func runDeleteBlobs(ctx context.Context, rep *repo.Repository) error {
for _, b := range *blobDeleteBlobIDs {
err := rep.Blobs.DeleteBlob(ctx, blob.ID(b))
if err != nil {
return errors.Wrapf(err, "error deleting %v", b)
}
}
return nil
}
func init() {
blobDeleteCommand.Action(repositoryAction(runDeleteBlobs))
}