Files
w3cjandClaude Opus 5.5 8e851cddf4 feat(ui): devvm's logo atop the root help, the first run and each new VM's summary
The logo prints from the UI alone (ui.UI.Logo, msg.Reporter's Logo), once
a run, only with stdout a terminal (or a test build's PickOnPipe), not with
--no-input, --json or names mode; its mark green, plain under NO_COLOR. The
CLI reference's pages don't get it: only the root's help func prints it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-06 00:35:59 -07:00

36 lines
1.1 KiB
Go
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package ui
import "strings"
// logoText is devvm's logo, its three lines; logoMark is the prompt's
// mark in it, which the logo's color paints.
const (
logoText = "╭──────────╮\n" +
"│ ❯ devvm ╭┤\n" +
"╰─────────██\n"
logoMark = "❯"
sgrBrand = "32" // the logo's mark: green, as the done mark
)
// logo is devvm's logo as the style prints it: the mark green when
// colored, the frame in the terminal's own color.
func (s style) logo() string {
return strings.Replace(logoText, logoMark, s.paint(sgrBrand, logoMark), 1)
}
// Logo prints devvm's logo to stdout, once a run, only for someone
// watching it (logoShows).
func (u *UI) Logo() {
if !logoShows(u) || u.logoShown.Swap(true) {
return
}
u.write(u.stdout, u.outStyle.logo())
}
// logoShows reports whether u shows the logo: with stdout a terminal (or
// a test build's PickOnPipe), but not with --no-input, after DataOnly
// (--json) or in names mode.
func logoShows(u *UI) bool {
return (u.stdoutTTY || u.pickOnPipe.Load()) && !u.noInput.Load() && !u.dataOnly.Load() && !u.outStyle.names
}