Files
kopia/cli/command_content_rm.go
Jarek Kowalski e03971fc59 Upgraded linter to v1.33.0 (#734)
* linter: upgraded to 1.33, disabled some linters

* lint: fixed 'errorlint' errors

This ensures that all error comparisons use errors.Is() or errors.As().
We will be wrapping more errors going forward so it's important that
error checks are not strict everywhere.

Verified that there are no exceptions for errorlint linter which
guarantees that.

* lint: fixed or suppressed wrapcheck errors

* lint: nolintlint and misc cleanups

Co-authored-by: Julio López <julio+gh@kasten.io>
2020-12-21 22:39:22 -08:00

33 lines
755 B
Go

package cli
import (
"context"
"github.com/pkg/errors"
"github.com/kopia/kopia/repo"
)
var (
contentRemoveCommand = contentCommands.Command("remove", "Remove content").Alias("rm")
contentRemoveIDs = contentRemoveCommand.Arg("id", "IDs of content to remove").Required().Strings()
)
func runContentRemoveCommand(ctx context.Context, rep *repo.DirectRepository) error {
advancedCommand(ctx)
for _, contentID := range toContentIDs(*contentRemoveIDs) {
if err := rep.Content.DeleteContent(ctx, contentID); err != nil {
return errors.Wrapf(err, "error deleting content %v", contentID)
}
}
return nil
}
func init() {
setupShowCommand(contentRemoveCommand)
contentRemoveCommand.Action(directRepositoryAction(runContentRemoveCommand))
}