Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

Commit 9f0e1e0

Browse files
authored
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. <details><summary>before/after</summary> <p> <img src="https://github.com/user-attachments/assets/22d94ebb-e247-4e4e-8dab-1f502f1e8b46"/> <img src="https://github.com/user-attachments/assets/7cbbf41b-a926-4ebd-9f6d-bbdd779cc8b4"/> </p> </details> ## Test plan <!-- REQUIRED; info at https://docs-legacy.sourcegraph.com/dev/background-information/testing_principles --> Locally tested, see before/after.
1 parent 3ff0f07 commit 9f0e1e0

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

dev/sg/internal/run/command.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,13 @@ func startSgCmd(ctx context.Context, cmd SGConfigCommand, parentEnv map[string]s
298298
}
299299

300300
if conf.Preamble != "" {
301-
std.Out.WriteLine(output.Styledf(output.StyleOrange, "[%s] %s %s", conf.Name, output.EmojiInfo, conf.Preamble))
301+
// White on purple'ish gray, to make it noticeable, but not burning everyone eyes.
302+
preambleStyle := output.CombineStyles(output.Bg256Color(60), output.Fg256Color(255))
303+
lines := strings.Split(conf.Preamble, "\n")
304+
for _, line := range lines {
305+
// Pad with 16 chars, so it matches the other commands prefixes.
306+
std.Out.WriteLine(output.Styledf(preambleStyle, "[%-16s] %s %s", fmt.Sprintf("📣 %s", conf.Name), output.EmojiInfo, line))
307+
}
302308
}
303309

304310
return startCmd(ctx, opts)

0 commit comments

Comments
 (0)