|
|
|
@ -160,11 +160,19 @@ 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's set,
|
|
|
|
// printing a deprecation warning, and copying its value to the new flag.
|
|
|
|
// handleDeprecatedForceFlag handles the deprecated -force flag by checking if it was
|
|
|
|
// explicitly provided (in any form), printing a deprecation warning, and copying its
|
|
|
|
// value to the new flag. This ensures that explicit -force=false takes precedence.
|
|
|
|
// Returns true if the deprecated flag was used.
|
|
|
|
func handleDeprecatedForceFlag(writer io.Writer, forceAlias *bool, applyFlag *bool) bool { |
|
|
|
if *forceAlias != false { |
|
|
|
func handleDeprecatedForceFlag(writer io.Writer, args []string, forceAlias *bool, applyFlag *bool) bool { |
|
|
|
forceIsSet := false |
|
|
|
for _, arg := range args { |
|
|
|
if arg == "-force" || strings.HasPrefix(arg, "-force=") { |
|
|
|
forceIsSet = true |
|
|
|
break |
|
|
|
} |
|
|
|
} |
|
|
|
if forceIsSet { |
|
|
|
fmt.Fprintf(writer, "WARNING: -force is deprecated, please use -apply instead\n") |
|
|
|
*applyFlag = *forceAlias |
|
|
|
return true |
|
|
|
|