fix(cli): use simple logo in CLI (#20585)
This commit is contained in:
@@ -1,9 +1,15 @@
|
|||||||
import z from "zod"
|
import z from "zod"
|
||||||
import { EOL } from "os"
|
import { EOL } from "os"
|
||||||
import { NamedError } from "@opencode-ai/util/error"
|
import { NamedError } from "@opencode-ai/util/error"
|
||||||
import { logo as glyphs } from "./logo"
|
|
||||||
|
|
||||||
export namespace UI {
|
export namespace UI {
|
||||||
|
const wordmark = [
|
||||||
|
`⠀ ▄ `,
|
||||||
|
`█▀▀█ █▀▀█ █▀▀█ █▀▀▄ █▀▀▀ █▀▀█ █▀▀█ █▀▀█`,
|
||||||
|
`█ █ █ █ █▀▀▀ █ █ █ █ █ █ █ █▀▀▀`,
|
||||||
|
`▀▀▀▀ █▀▀▀ ▀▀▀▀ ▀ ▀ ▀▀▀▀ ▀▀▀▀ ▀▀▀▀ ▀▀▀▀`,
|
||||||
|
]
|
||||||
|
|
||||||
export const CancelledError = NamedError.create("UICancelledError", z.void())
|
export const CancelledError = NamedError.create("UICancelledError", z.void())
|
||||||
|
|
||||||
export const Style = {
|
export const Style = {
|
||||||
@@ -41,50 +47,12 @@ export namespace UI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function logo(pad?: string) {
|
export function logo(pad?: string) {
|
||||||
const result: string[] = []
|
const result = []
|
||||||
const reset = "\x1b[0m"
|
for (const row of wordmark) {
|
||||||
const left = {
|
|
||||||
fg: "\x1b[90m",
|
|
||||||
shadow: "\x1b[38;5;235m",
|
|
||||||
bg: "\x1b[48;5;235m",
|
|
||||||
}
|
|
||||||
const right = {
|
|
||||||
fg: reset,
|
|
||||||
shadow: "\x1b[38;5;238m",
|
|
||||||
bg: "\x1b[48;5;238m",
|
|
||||||
}
|
|
||||||
const gap = " "
|
|
||||||
const draw = (line: string, fg: string, shadow: string, bg: string) => {
|
|
||||||
const parts: string[] = []
|
|
||||||
for (const char of line) {
|
|
||||||
if (char === "_") {
|
|
||||||
parts.push(bg, " ", reset)
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
if (char === "^") {
|
|
||||||
parts.push(fg, bg, "▀", reset)
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
if (char === "~") {
|
|
||||||
parts.push(shadow, "▀", reset)
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
if (char === " ") {
|
|
||||||
parts.push(" ")
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
parts.push(fg, char, reset)
|
|
||||||
}
|
|
||||||
return parts.join("")
|
|
||||||
}
|
|
||||||
glyphs.left.forEach((row, index) => {
|
|
||||||
if (pad) result.push(pad)
|
if (pad) result.push(pad)
|
||||||
result.push(draw(row, left.fg, left.shadow, left.bg))
|
result.push(row)
|
||||||
result.push(gap)
|
|
||||||
const other = glyphs.right[index] ?? ""
|
|
||||||
result.push(draw(other, right.fg, right.shadow, right.bg))
|
|
||||||
result.push(EOL)
|
result.push(EOL)
|
||||||
})
|
}
|
||||||
return result.join("").trimEnd()
|
return result.join("").trimEnd()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user