mirror of
https://github.com/kopia/kopia.git
synced 2026-01-17 02:48:00 -05:00
* logging: cleaned up stderr logging - do not show module - do not show timestamps by default (enable with --console-timestamps) * logging: replaced most printStderr() with log.Info * cli: additional logging cleanup
33 lines
674 B
Go
33 lines
674 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", "Delete blobs by ID").Alias("rm")
|
|
blobDeleteBlobIDs = blobDeleteCommand.Arg("blobIDs", "Blob IDs").Required().Strings()
|
|
)
|
|
|
|
func runDeleteBlobs(ctx context.Context, rep *repo.DirectRepository) error {
|
|
advancedCommand(ctx)
|
|
|
|
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(directRepositoryAction(runDeleteBlobs))
|
|
}
|