From 9f0e1e04b885fa1dd4a346b6a2a6fcae6b95cdbf Mon Sep 17 00:00:00 2001 From: Jean-Hadrien Chabran Date: Wed, 7 Aug 2024 17:20:07 +0200 Subject: [PATCH] chore(local): improve runnable cmds preambles in sg start (#64339) `sg start ...` commands have a preamble field to inform the user about various things. Prior to this PR, they were rather easy to miss. Along the way, I've fixed the printing so if there multiple lines of preamble, they appear nicely. This PR addresses that.
before/after

## Test plan Locally tested, see before/after. --- dev/sg/internal/run/command.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/dev/sg/internal/run/command.go b/dev/sg/internal/run/command.go index 215272f3b38..cbc2076fae6 100644 --- a/dev/sg/internal/run/command.go +++ b/dev/sg/internal/run/command.go @@ -298,7 +298,13 @@ func startSgCmd(ctx context.Context, cmd SGConfigCommand, parentEnv map[string]s } if conf.Preamble != "" { - std.Out.WriteLine(output.Styledf(output.StyleOrange, "[%s] %s %s", conf.Name, output.EmojiInfo, conf.Preamble)) + // White on purple'ish gray, to make it noticeable, but not burning everyone eyes. + preambleStyle := output.CombineStyles(output.Bg256Color(60), output.Fg256Color(255)) + lines := strings.Split(conf.Preamble, "\n") + for _, line := range lines { + // Pad with 16 chars, so it matches the other commands prefixes. + std.Out.WriteLine(output.Styledf(preambleStyle, "[%-16s] %s %s", fmt.Sprintf("📣 %s", conf.Name), output.EmojiInfo, line)) + } } return startCmd(ctx, opts)