Refactor warning message for incompatible flags in --run-file

Signed-off-by: twinguy <twinguy17@gmail.com>
This commit is contained in:
twinguy 2025-03-24 16:32:13 -05:00
parent ce0b9fb4d9
commit e7c1a322d7
No known key found for this signature in database
GPG Key ID: 70E5665641CA5676
1 changed files with 1 additions and 9 deletions

View File

@ -146,7 +146,7 @@ dapr run --run-file /path/to/directory -k
incompatibleFlags := detectIncompatibleFlags(cmd)
if len(incompatibleFlags) > 0 {
// Print warning message about incompatible flags
warningMsg := generateWarningMessage(incompatibleFlags)
warningMsg := "The following flags are ignored when using --run-file and should be configured in the run file instead: " + strings.Join(incompatibleFlags, ", ")
print.WarningStatusEvent(os.Stdout, warningMsg)
}
@ -1102,11 +1102,3 @@ func detectIncompatibleFlags(cmd *cobra.Command) []string {
return incompatibleFlags
}
// generateWarningMessage creates an appropriate warning message based on the
// number and types of incompatible flags
func generateWarningMessage(incompatibleFlags []string) string {
return fmt.Sprintf(
"The following flags are ignored when using --run-file and should be configured in the run file instead: %s",
strings.Join(incompatibleFlags, ", "))
}