fixup! diigo-cache: RSS in diigo's export shape, from cached items

compare-export.ts: the usage exit status is a named constant,
BAD_USAGE = 2, whose JSDoc cites the convention (Bash Reference Manual
§3.7.5); the manual just says "Exits 2 on bad usage".

Generated-by: Claude Opus 5.5
This commit is contained in:
dckc committed 2026-10-07 09:40:10 -05:00
1 parent 549ff5bf4b
commit a40d2e924a
1 file changed
+10 -4
+10 -4
View File
@@ -8,9 +8,7 @@
* the export, keyed on link: title, tags, description, highlights and
* sticky notes. Prints counts to stdout; writes <out-dir>/from-cache.rss
* and <out-dir>/report.json (mismatched links, by category). Exits 2 on
* bad usage, the shell's convention.
*
* @see https://www.gnu.org/software/bash/manual/html_node/Exit-Status.html
* bad usage.
*/
import * as nodeFs from "node:fs/promises";
import { basename, join } from "node:path";
@@ -19,6 +17,14 @@ import { itemDescription, toRss } from "../src/rss.ts";
type Item = Record<string, unknown>;
/**
* the exit status for incorrect usage (invalid options, missing
* arguments): the shell's convention
*
* @see https://www.gnu.org/software/bash/manual/html_node/Exit-Status.html
*/
const BAD_USAGE = 2;
/** one export item, as read */
type Exported = { title: string; link: string; description: string };
@@ -142,7 +148,7 @@ export async function main(
const [dbPath, exportPath, outPath] = argv;
if (!dbPath || !exportPath || !outPath) {
stderr.write("usage: node scripts/compare-export.ts <cache.sqlite> <export.xml> <out-dir>\n");
return exit(2);
return exit(BAD_USAGE);
}
const cache = cacheItems(connect(dbPath));
const out = outDir(fs, outPath);