mirror of
https://github.com/kopia/kopia.git
synced 2026-01-16 18:37:52 -05:00
* 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>
33 lines
755 B
Go
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))
|
|
}
|