mirror of
https://github.com/kopia/kopia.git
synced 2025-12-23 22:57:50 -05:00
fix(cli): additional safeguard dangerous commands (#4767)
This commit is contained in:
@@ -16,7 +16,7 @@ type commandBlobDelete struct {
|
||||
}
|
||||
|
||||
func (c *commandBlobDelete) setup(svc appServices, parent commandParent) {
|
||||
cmd := parent.Command("delete", "Delete blobs by ID").Alias("remove").Alias("rm")
|
||||
cmd := parent.Command("delete", "Delete blobs by ID").Alias("remove").Alias("rm").Hidden()
|
||||
cmd.Arg("blobIDs", "Blob IDs").Required().StringsVar(&c.blobIDs)
|
||||
cmd.Action(svc.directRepositoryWriteAction(c.run))
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ type commandBlobGC struct {
|
||||
}
|
||||
|
||||
func (c *commandBlobGC) setup(svc appServices, parent commandParent) {
|
||||
cmd := parent.Command("gc", "Garbage-collect unused blobs")
|
||||
cmd := parent.Command("gc", "Garbage-collect unused blobs").Hidden()
|
||||
cmd.Flag("delete", "Whether to delete unused blobs").StringVar(&c.delete)
|
||||
cmd.Flag("parallel", "Number of parallel blob scans").Default("16").IntVar(&c.parallel)
|
||||
cmd.Flag("prefix", "Only GC blobs with given prefix").StringVar(&c.prefix)
|
||||
|
||||
@@ -15,7 +15,7 @@ type commandContentDelete struct {
|
||||
}
|
||||
|
||||
func (c *commandContentDelete) setup(svc appServices, parent commandParent) {
|
||||
cmd := parent.Command("delete", "Remove content").Alias("remove").Alias("rm")
|
||||
cmd := parent.Command("delete", "Remove content").Alias("remove").Alias("rm").Hidden()
|
||||
cmd.Arg("id", "IDs of content to remove").Required().StringsVar(&c.ids)
|
||||
cmd.Action(svc.directRepositoryWriteAction(c.run))
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ type commandContentRewrite struct {
|
||||
}
|
||||
|
||||
func (c *commandContentRewrite) setup(svc appServices, parent commandParent) {
|
||||
cmd := parent.Command("rewrite", "Rewrite content using most recent format")
|
||||
cmd := parent.Command("rewrite", "Rewrite content using most recent format").Hidden()
|
||||
cmd.Arg("contentID", "Identifiers of contents to rewrite").StringsVar(&c.contentRewriteIDs)
|
||||
cmd.Flag("parallelism", "Number of parallel workers").Default("16").IntVar(&c.contentRewriteParallelism)
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ type commandIndexOptimize struct {
|
||||
}
|
||||
|
||||
func (c *commandIndexOptimize) setup(svc appServices, parent commandParent) {
|
||||
cmd := parent.Command("optimize", "Optimize indexes blobs.")
|
||||
cmd := parent.Command("optimize", "Optimize indexes blobs.").Hidden()
|
||||
cmd.Flag("max-small-blobs", "Maximum number of small index blobs that can be left after compaction.").Default("1").IntVar(&c.optimizeMaxSmallBlobs)
|
||||
cmd.Flag("drop-deleted-older-than", "Drop deleted contents above given age").DurationVar(&c.optimizeDropDeletedOlderThan)
|
||||
cmd.Flag("drop-contents", "Drop contents with given IDs").StringsVar(&c.optimizeDropContents)
|
||||
|
||||
@@ -15,7 +15,7 @@ type commandManifestDelete struct {
|
||||
}
|
||||
|
||||
func (c *commandManifestDelete) setup(svc appServices, parent commandParent) {
|
||||
cmd := parent.Command("delete", "Remove manifest items").Alias("remove").Alias("rm")
|
||||
cmd := parent.Command("delete", "Remove manifest items").Alias("remove").Alias("rm").Hidden()
|
||||
cmd.Arg("item", "Items to remove").Required().StringsVar(&c.manifestRemoveItems)
|
||||
cmd.Action(svc.repositoryWriterAction(c.run))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user