mirror of
https://github.com/kopia/kopia.git
synced 2026-03-24 09:04:04 -04:00
30 lines
637 B
Go
30 lines
637 B
Go
package cli
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/pkg/errors"
|
|
|
|
"github.com/kopia/kopia/repo"
|
|
)
|
|
|
|
var (
|
|
storageDeleteCommand = storageCommands.Command("delete", "Show storage blocks").Alias("rm")
|
|
storageDeleteBlockIDs = storageDeleteCommand.Arg("blockIDs", "Block IDs").Required().Strings()
|
|
)
|
|
|
|
func runDeleteStorageBlocks(ctx context.Context, rep *repo.Repository) error {
|
|
for _, b := range *storageDeleteBlockIDs {
|
|
err := rep.Storage.DeleteBlock(ctx, b)
|
|
if err != nil {
|
|
return errors.Wrapf(err, "error deleting %v", b)
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func init() {
|
|
storageDeleteCommand.Action(repositoryAction(runDeleteStorageBlocks))
|
|
}
|