the tangled network observatory ◈ every knot, its health, its version, in your terminal
tangled cli tui knot monitoring observability atproto federation
0

Configure Feed

Select the types of activity you want to include in your feed.

fid / src / cli.ts
1.5 kB 53 lines
1#!/usr/bin/env node 2import { readFileSync } from "node:fs"; 3import { parse } from "@bomb.sh/args"; 4import { animateBanner } from "./banner.js"; 5 6const args = parse(process.argv.slice(2), { 7 boolean: ["json", "all", "fresh", "help", "version", "mine"], 8 string: ["as"], 9 alias: { h: "help", v: "version" }, 10}); 11 12const usage = `usage: 13 fid list every knot on the network 14 --json machine-readable output 15 --all include localhost/dev junk knots 16 --fresh skip the 5-minute cache 17 fid check <host> health-check one knot (exit 0 ok / 1 stale / 2 down) 18 --mine check every knot you own instead 19 --as <handle> who you are (or {"handle":"..."} in ~/.config/fid/config.json) 20 fid --version print the version 21`; 22 23if (args.version) { 24 const pkg = JSON.parse( 25 readFileSync(new URL("../package.json", import.meta.url), "utf8"), 26 ); 27 console.log(`fid ${pkg.version}`); 28 process.exit(0); 29} 30 31const [command] = args._; 32if (!args.json) await animateBanner(); // keep --json pipe-clean 33 34if (args.help || !command) { 35 console.log(usage); 36 process.exit(command ? 0 : 1); 37} 38 39switch (command) { 40 case "list": 41 await (await import("./commands/list.js")).run(args); 42 break; 43 case "check": 44 await (await import("./commands/check.js")).run( 45 args, 46 args._[1] === undefined ? undefined : String(args._[1]), 47 ); 48 break; 49 default: 50 console.error(`unknown command: ${command}\n`); 51 console.log(usage); 52 process.exit(1); 53}