mirror of https://github.com/dapr/cli.git
Refactor warning message for incompatible flags in --run-file
Signed-off-by: twinguy <twinguy17@gmail.com>
This commit is contained in:
parent
ce0b9fb4d9
commit
e7c1a322d7
10
cmd/run.go
10
cmd/run.go
|
|
@ -146,7 +146,7 @@ dapr run --run-file /path/to/directory -k
|
||||||
incompatibleFlags := detectIncompatibleFlags(cmd)
|
incompatibleFlags := detectIncompatibleFlags(cmd)
|
||||||
if len(incompatibleFlags) > 0 {
|
if len(incompatibleFlags) > 0 {
|
||||||
// Print warning message about incompatible flags
|
// 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)
|
print.WarningStatusEvent(os.Stdout, warningMsg)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1102,11 +1102,3 @@ func detectIncompatibleFlags(cmd *cobra.Command) []string {
|
||||||
|
|
||||||
return incompatibleFlags
|
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, ", "))
|
|
||||||
}
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue