alpha
Login
or
Join now
paulvall.dev
/
fid
Star
0
Fork
0
Atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
the tangled network observatory ◈ every knot, its health, its version, in your terminal
tangled
cli
tui
knot
monitoring
observability
atproto
federation
Star
0
Fork
0
Atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
Overview
Issues
Pulls
Pipelines
feat: colorize help output
author
Paul Valladares
date
5 days ago
(Jul 21, 2026, 5:05 PM -0600)
commit
a706de8b
a706de8b75f1ada1ab4bc18be933f7906f6ccc23
parent
c353d9c7
c353d9c7a2e0b595d8f6ba6e71ba2a25bc3cc300
+25
-3
2 changed files
Expand all
Collapse all
Unified
Split
src
cli.ts
tui
board.ts
+23
-2
src/cli.ts
View file
Reviewed
···
1
1
#!/usr/bin/env node
2
2
import { readFileSync } from "node:fs";
3
3
+
import { styleText } from "node:util";
3
4
import { parse } from "@bomb.sh/args";
4
5
import { animateBanner } from "./banner.js";
5
6
···
23
24
fid --version print the version
24
25
`;
25
26
27
27
+
// colors go in after the columns are padded, so alignment math never sees ansi
28
28
+
const colorUsage = (s: string) =>
29
29
+
s
30
30
+
.split("\n")
31
31
+
.map((line) => {
32
32
+
if (line === "usage:") return styleText("dim", line);
33
33
+
const m = /^(\s+)(\S.*?)(\s{2,})(.*)$/.exec(line);
34
34
+
if (!m) return line;
35
35
+
const [, indent, left, gap, desc] = m;
36
36
+
const colored = left
37
37
+
.replace(
38
38
+
/^fid (?!--)(\S+)/,
39
39
+
(_, cmd: string) => `fid ${styleText(["green", "bold"], cmd)}`,
40
40
+
)
41
41
+
.replace(/--[\w-]+/g, (f) => styleText("cyan", f))
42
42
+
.replace(/<[^>]+>/g, (a) => styleText("magenta", a));
43
43
+
return indent + colored + gap + styleText("dim", desc);
44
44
+
})
45
45
+
.join("\n");
46
46
+
26
47
if (args.version) {
27
48
const pkg = JSON.parse(
28
49
readFileSync(new URL("../package.json", import.meta.url), "utf8"),
···
36
57
if (!args.json && command !== "watch") await animateBanner();
37
58
38
59
if (args.help || !command) {
39
39
-
console.log(usage);
60
60
+
console.log(colorUsage(usage));
40
61
process.exit(command ? 0 : 1);
41
62
}
42
63
···
64
85
break;
65
86
default:
66
87
console.error(`unknown command: ${command}\n`);
67
67
-
console.log(usage);
88
88
+
console.log(colorUsage(usage));
68
89
process.exit(1);
69
90
}
+2
-1
src/tui/board.ts
View file
Reviewed
···
142
142
.entries()) {
143
143
const index = state.offset + i;
144
144
const selected = index === state.selected;
145
145
-
const flashedAgo = now - (state.changed.get(row.host) ?? Number.NEGATIVE_INFINITY);
145
145
+
const flashedAgo =
146
146
+
now - (state.changed.get(row.host) ?? Number.NEGATIVE_INFINITY);
146
147
const flashing = flashedAgo < FLASH_MS;
147
148
ops.push(
148
149
open(`row-${row.host}`, {