Skip to content

Commit b2fe022

Browse files
committed
manually pick PrintFailure changes
Signed-off-by: Fabian Gonzalez <fabian.gonzalez@solo.io>
1 parent 1c000cc commit b2fe022

2 files changed

Lines changed: 10 additions & 3 deletions

File tree

internal/cli/status.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ func runStatus() error {
3535

3636
health, err := c.CheckHealth()
3737
if err != nil {
38-
printer.PrintError(fmt.Sprintf("Daemon is not running (%s)", c.BaseURL))
39-
printer.PrintError("Database is not healthy")
38+
printer.PrintFailure(fmt.Sprintf("Daemon is not running (%s)", c.BaseURL))
39+
printer.PrintFailure("Database is not healthy")
4040
return nil
4141
}
4242

@@ -49,7 +49,7 @@ func runStatus() error {
4949
if health.Database == "ok" {
5050
printer.PrintSuccess("Database is healthy")
5151
} else {
52-
printer.PrintError(fmt.Sprintf("Database is not healthy: %s", health.Database))
52+
printer.PrintFailure(fmt.Sprintf("Database is not healthy: %s", health.Database))
5353
}
5454

5555
return nil

pkg/printer/printer.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,13 @@ func PrintError(message string) {
4646
fmt.Fprintf(os.Stderr, "Error: %s\n", message)
4747
}
4848

49+
// PrintFailure prints a negative-status message with a cross-mark prefix to stdout.
50+
// Use for reporting expected negative conditions (e.g. "daemon is not running")
51+
// rather than PrintError which implies an unexpected error.
52+
func PrintFailure(message string) {
53+
_, _ = fmt.Fprintf(os.Stdout, "✗ %s\n", message)
54+
}
55+
4956
// PrintWarning prints a warning message
5057
func PrintWarning(message string) {
5158
_, _ = fmt.Fprintf(os.Stdout, "Warning: %s\n", message)

0 commit comments

Comments
 (0)