Skip to content

Commit b7af3dd

Browse files
committed
feat: better output when no namespace
1 parent e4696ec commit b7af3dd

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

internal/format/pretty/pretty.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,11 @@ func (h *Handler) StyledMetricName(metric messages.DogStatsDMetric, width int) s
8888
namespace = namespace[:lenNamespace-sub-1] + "~"
8989
}
9090
}
91-
text := fmt.Sprintf("%s | %s",
92-
lipgloss.NewStyle().Foreground(h.Theme.Lavender()).Render(namespace),
93-
lipgloss.NewStyle().Bold(true).Foreground(h.Theme.Pink()).Render(name))
91+
var text string
92+
if lenNamespace != 0 {
93+
text += lipgloss.NewStyle().Foreground(h.Theme.Lavender()).Render(namespace) + " | "
94+
}
95+
text += lipgloss.NewStyle().Bold(true).Foreground(h.Theme.Pink()).Render(name)
9496
return lipgloss.NewStyle().
9597
Width(width).
9698
MaxWidth(width).

0 commit comments

Comments
 (0)