Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions internal/output/plain_format.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ func formatStatusLine(e ContainerStatusEvent) (string, bool) {
return "Waiting for LocalStack to be ready...", true
case "ready":
if e.Detail != "" {
return fmt.Sprintf("LocalStack ready (%s)", e.Detail), true
return fmt.Sprintf("%s LocalStack ready (%s)", SuccessMarkerText(), e.Detail), true
}
return "LocalStack ready", true
return SuccessMarkerText() + " LocalStack ready", true
default:
if e.Detail != "" {
return fmt.Sprintf("LocalStack: %s (%s)", e.Phase, e.Detail), true
Expand Down Expand Up @@ -112,7 +112,7 @@ func formatAuthEvent(e AuthEvent) string {
func formatMessageEvent(e MessageEvent) string {
switch e.Severity {
case SeveritySuccess:
return "> Success: " + e.Text
return SuccessMarkerText() + " " + e.Text
case SeverityNote:
return "> Note: " + e.Text
case SeverityWarning:
Expand Down
4 changes: 2 additions & 2 deletions internal/output/plain_format_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func TestFormatEventLine(t *testing.T) {
{
name: "message event success",
event: MessageEvent{Severity: SeveritySuccess, Text: "done"},
want: "> Success: done",
want: SuccessMarkerText() + " done",
wantOK: true,
},
{
Expand Down Expand Up @@ -56,7 +56,7 @@ func TestFormatEventLine(t *testing.T) {
{
name: "status ready with detail",
event: ContainerStatusEvent{Phase: "ready", Container: "localstack-aws", Detail: "abc123"},
want: "LocalStack ready (abc123)",
want: SuccessMarkerText() + " LocalStack ready (abc123)",
wantOK: true,
},
{
Expand Down
4 changes: 2 additions & 2 deletions internal/output/plain_sink_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,12 @@ func TestPlainSink_EmitsStatusEvent(t *testing.T) {
{
name: "ready phase with detail",
event: ContainerStatusEvent{Phase: "ready", Container: "localstack-aws", Detail: "abc123"},
expected: "LocalStack ready (abc123)\n",
expected: fmt.Sprintf("%s LocalStack ready (abc123)\n", SuccessMarkerText()),
},
{
name: "ready phase without detail",
event: ContainerStatusEvent{Phase: "ready", Container: "localstack-aws"},
expected: "LocalStack ready\n",
expected: fmt.Sprintf("%s LocalStack ready\n", SuccessMarkerText()),
},
{
name: "unknown phase with detail",
Expand Down
13 changes: 13 additions & 0 deletions internal/output/style.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package output

import "fmt"

const SuccessColorHex = "#B7C95C"

func SuccessMarker() string {
return fmt.Sprintf("\x1b[38;2;183;201;92m%s\x1b[0m", SuccessMarkerText())
}

func SuccessMarkerText() string {
return "✔︎"
}
2 changes: 1 addition & 1 deletion internal/ui/app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ func TestAppMessageEventRendering(t *testing.T) {
if len(app.lines) != 1 {
t.Fatalf("expected 1 line, got %d", len(app.lines))
}
if !strings.Contains(app.lines[0].text, "Success:") || !strings.Contains(app.lines[0].text, "Done") {
if !strings.Contains(app.lines[0].text, output.SuccessMarkerText()) || !strings.Contains(app.lines[0].text, "Done") {
t.Fatalf("expected rendered success message, got: %q", app.lines[0].text)
}
}
Expand Down
2 changes: 1 addition & 1 deletion internal/ui/components/message.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ func RenderMessage(e output.MessageEvent) string {
prefix := styles.Secondary.Render("> ")
switch e.Severity {
case output.SeveritySuccess:
return prefix + styles.Success.Render("Success:") + " " + styles.Message.Render(e.Text)
return styles.Success.Render(output.SuccessMarkerText()) + " " + styles.Message.Render(e.Text)
case output.SeverityNote:
return prefix + styles.Note.Render("Note:") + " " + styles.Message.Render(e.Text)
case output.SeverityWarning:
Expand Down
7 changes: 5 additions & 2 deletions internal/ui/styles/styles.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package styles

import "github.com/charmbracelet/lipgloss"
import (
"github.com/charmbracelet/lipgloss"
"github.com/localstack/lstk/internal/output"
)

const (
NimboDarkColor = "#3F51C7"
Expand Down Expand Up @@ -39,7 +42,7 @@ var (

// Message severity styles
Success = lipgloss.NewStyle().
Foreground(lipgloss.Color("42"))
Foreground(lipgloss.Color(output.SuccessColorHex))

Note = lipgloss.NewStyle().
Foreground(lipgloss.Color("33"))
Expand Down
Loading