aboutsummaryrefslogtreecommitdiff
path: root/weed/shell/command_collection_delete.go
diff options
context:
space:
mode:
authorLisandro Pin <lisandro.pin@proton.ch>2025-11-10 04:58:38 +0100
committerGitHub <noreply@github.com>2025-11-09 19:58:38 -0800
commit76e4a519646a60c612956d197652359b1d4ba477 (patch)
tree37de583f5f6e79936bc137afe6e6d4b12e6065a5 /weed/shell/command_collection_delete.go
parent2a05af2e14741540cad00a410f8e851f863628c7 (diff)
downloadseaweedfs-76e4a519646a60c612956d197652359b1d4ba477.tar.xz
seaweedfs-76e4a519646a60c612956d197652359b1d4ba477.zip
Unify the parameter to disable dry-run on weed shell commands to `-apply` (instead of `-force`). (#7450)
* Unify the parameter to disable dry-run on weed shell commands to --apply (instead of --force). * lint * refactor * Execution Order Corrected * handle deprecated force flag * fix help messages * Refactoring]: Using flag.FlagSet.Visit() * consistent with other commands * Checks for both flags * fix toml files --------- Co-authored-by: chrislu <chris.lu@gmail.com>
Diffstat (limited to 'weed/shell/command_collection_delete.go')
-rw-r--r--weed/shell/command_collection_delete.go13
1 files changed, 9 insertions, 4 deletions
diff --git a/weed/shell/command_collection_delete.go b/weed/shell/command_collection_delete.go
index 0239d4c55..92473e8e3 100644
--- a/weed/shell/command_collection_delete.go
+++ b/weed/shell/command_collection_delete.go
@@ -23,7 +23,7 @@ func (c *commandCollectionDelete) Name() string {
func (c *commandCollectionDelete) Help() string {
return `delete specified collection
- collection.delete -collection <collection_name> -force
+ collection.delete -collection <collection_name> -apply
`
}
@@ -36,11 +36,16 @@ func (c *commandCollectionDelete) Do(args []string, commandEnv *CommandEnv, writ
colDeleteCommand := flag.NewFlagSet(c.Name(), flag.ContinueOnError)
collectionName := colDeleteCommand.String("collection", "", "collection to delete. Use '_default_' for the empty-named collection.")
- applyBalancing := colDeleteCommand.Bool("force", false, "apply the collection")
+ applyBalancing := colDeleteCommand.Bool("apply", false, "apply the collection")
+ // TODO: remove this alias
+ applyBalancingAlias := colDeleteCommand.Bool("force", false, "apply the collection (alias for -apply)")
+
if err = colDeleteCommand.Parse(args); err != nil {
return nil
}
- infoAboutSimulationMode(writer, *applyBalancing, "-force")
+
+ handleDeprecatedForceFlag(writer, colDeleteCommand, applyBalancingAlias, applyBalancing)
+ infoAboutSimulationMode(writer, *applyBalancing, "-apply")
if err = commandEnv.confirmIsLocked(args); err != nil {
return
@@ -55,7 +60,7 @@ func (c *commandCollectionDelete) Do(args []string, commandEnv *CommandEnv, writ
}
if !*applyBalancing {
- fmt.Fprintf(writer, "collection '%s' will be deleted. Use -force to apply the change.\n", *collectionName)
+ fmt.Fprintf(writer, "collection '%s' will be deleted. Use -apply to apply the change.\n", *collectionName)
return nil
}