From 515ee7baaf6bd41d5cf08372cb04fdaa135ee5cc Mon Sep 17 00:00:00 2001 From: chrislu Date: Sun, 9 Nov 2025 19:45:57 -0800 Subject: [PATCH] Checks for both flags --- weed/shell/command_fs_configure.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/weed/shell/command_fs_configure.go b/weed/shell/command_fs_configure.go index 547879f43..84568c766 100644 --- a/weed/shell/command_fs_configure.go +++ b/weed/shell/command_fs_configure.go @@ -165,14 +165,22 @@ func infoAboutSimulationMode(writer io.Writer, forceMode bool, forceModeOption s // 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) { - if f.Name == "force" { + switch f.Name { + case "force": forceIsSet = true + case "apply": + applyIsSet = true } }) if forceIsSet { - fmt.Fprintf(writer, "WARNING: -force is deprecated, please use -apply instead\n") + 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 } }