fix(cli): additional safeguard dangerous commands (#4767)

This commit is contained in:
Julio Lopez
2025-08-17 13:06:03 -07:00
committed by GitHub
parent 194acc15e5
commit c7678a24cd
6 changed files with 6 additions and 6 deletions

View File

@@ -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))

View File

@@ -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)

View File

@@ -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))

View File

@@ -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)

View File

@@ -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)

View File

@@ -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))