mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-05 20:10:21 +00:00
chore: Enable "curly" rule to avoid single-statement if confusion/errors.
This commit is contained in:
@@ -18,7 +18,9 @@ const graphemeSegmenter =
|
||||
: null;
|
||||
|
||||
function splitGraphemes(value: string): string[] {
|
||||
if (!graphemeSegmenter) return Array.from(value);
|
||||
if (!graphemeSegmenter) {
|
||||
return Array.from(value);
|
||||
}
|
||||
try {
|
||||
return Array.from(graphemeSegmenter.segment(value), (seg) => seg.segment);
|
||||
} catch {
|
||||
@@ -74,12 +76,20 @@ const LOBSTER_ASCII = [
|
||||
|
||||
export function formatCliBannerArt(options: BannerOptions = {}): string {
|
||||
const rich = options.richTty ?? isRich();
|
||||
if (!rich) return LOBSTER_ASCII.join("\n");
|
||||
if (!rich) {
|
||||
return LOBSTER_ASCII.join("\n");
|
||||
}
|
||||
|
||||
const colorChar = (ch: string) => {
|
||||
if (ch === "█") return theme.accentBright(ch);
|
||||
if (ch === "░") return theme.accentDim(ch);
|
||||
if (ch === "▀") return theme.accent(ch);
|
||||
if (ch === "█") {
|
||||
return theme.accentBright(ch);
|
||||
}
|
||||
if (ch === "░") {
|
||||
return theme.accentDim(ch);
|
||||
}
|
||||
if (ch === "▀") {
|
||||
return theme.accent(ch);
|
||||
}
|
||||
return theme.muted(ch);
|
||||
};
|
||||
|
||||
@@ -99,11 +109,19 @@ export function formatCliBannerArt(options: BannerOptions = {}): string {
|
||||
}
|
||||
|
||||
export function emitCliBanner(version: string, options: BannerOptions = {}) {
|
||||
if (bannerEmitted) return;
|
||||
if (bannerEmitted) {
|
||||
return;
|
||||
}
|
||||
const argv = options.argv ?? process.argv;
|
||||
if (!process.stdout.isTTY) return;
|
||||
if (hasJsonFlag(argv)) return;
|
||||
if (hasVersionFlag(argv)) return;
|
||||
if (!process.stdout.isTTY) {
|
||||
return;
|
||||
}
|
||||
if (hasJsonFlag(argv)) {
|
||||
return;
|
||||
}
|
||||
if (hasVersionFlag(argv)) {
|
||||
return;
|
||||
}
|
||||
const line = formatCliBannerLine(version, options);
|
||||
process.stdout.write(`\n${line}\n\n`);
|
||||
bannerEmitted = true;
|
||||
|
||||
Reference in New Issue
Block a user