aboutsummaryrefslogtreecommitdiff
path: root/weed/shell/command_fs_configure.go
diff options
context:
space:
mode:
Diffstat (limited to 'weed/shell/command_fs_configure.go')
-rw-r--r--weed/shell/command_fs_configure.go25
1 files changed, 25 insertions, 0 deletions
diff --git a/weed/shell/command_fs_configure.go b/weed/shell/command_fs_configure.go
index c27c6c7b5..84568c766 100644
--- a/weed/shell/command_fs_configure.go
+++ b/weed/shell/command_fs_configure.go
@@ -159,3 +159,28 @@ func infoAboutSimulationMode(writer io.Writer, forceMode bool, forceModeOption s
}
fmt.Fprintf(writer, "Running in simulation mode. Use \"%s\" option to apply the changes.\n", forceModeOption)
}
+
+// handleDeprecatedForceFlag handles the deprecated -force flag by checking if it was
+// explicitly provided, printing a deprecation warning, and copying its
+// value to the new flag. This ensures that explicit -force=false takes precedence.
+func handleDeprecatedForceFlag(writer io.Writer, fs *flag.FlagSet, forceAlias *bool, applyFlag *bool) {
+ forceIsSet := false
+ applyIsSet := false
+ fs.Visit(func(f *flag.Flag) {
+ switch f.Name {
+ case "force":
+ forceIsSet = true
+ case "apply":
+ applyIsSet = true
+ }
+ })
+
+ if forceIsSet {
+ if applyIsSet {
+ fmt.Fprintf(writer, "WARNING: both -force and -apply are set. -force is deprecated and takes precedence. Please use only -apply.\n")
+ } else {
+ fmt.Fprintf(writer, "WARNING: -force is deprecated, please use -apply instead.\n")
+ }
+ *applyFlag = *forceAlias
+ }
+}