···
1
1
{
2
2
"name": "fid",
3
3
-
"version": "0.0.0",
3
3
+
"version": "0.0.1",
4
4
"description": "a network observatory for tangled — enumerate every knot, check their health, watch the federation",
5
5
"type": "module",
6
6
"bin": {
···
1
1
#!/usr/bin/env node
2
2
+
import { readFileSync } from "node:fs";
2
3
import { parse } from "@bomb.sh/args";
3
4
import { animateBanner } from "./banner.js";
4
5
5
6
const args = parse(process.argv.slice(2), {
6
6
-
boolean: ["json", "all", "fresh", "help"],
7
7
-
alias: { h: "help" },
7
7
+
boolean: ["json", "all", "fresh", "help", "version"],
8
8
+
alias: { h: "help", v: "version" },
8
9
});
9
10
10
11
const usage = `usage:
···
12
13
--json machine-readable output
13
14
--all include localhost/dev junk knots
14
15
--fresh skip the 5-minute cache
16
16
+
fid --version print the version
15
17
`;
18
18
+
19
19
+
if (args.version) {
20
20
+
const pkg = JSON.parse(
21
21
+
readFileSync(new URL("../package.json", import.meta.url), "utf8"),
22
22
+
);
23
23
+
console.log(`fid ${pkg.version}`);
24
24
+
process.exit(0);
25
25
+
}
16
26
17
27
const [command] = args._;
18
28
if (!args.json) await animateBanner(); // keep --json pipe-clean