Skip to content

Commit a6c1754

Browse files
committed
fix(verify): handle --check flag
1 parent 6c5cba4 commit a6c1754

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

tasks/gen-wcwidth.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -412,5 +412,14 @@ int wcwidth(uint32_t codepoint) {
412412
int iswprint(uint32_t codepoint) { return wcwidth(codepoint) >= 0; }
413413
`;
414414

415-
await Deno.writeTextFile("src/wcwidth.c", output);
416-
console.error("Wrote src/wcwidth.c");
415+
if (Deno.args.includes("--check")) {
416+
const existing = await Deno.readTextFile("src/wcwidth.c");
417+
if (existing !== output) {
418+
console.error("src/wcwidth.c is out of date — run: deno task gen-wcwidth");
419+
Deno.exit(1);
420+
}
421+
console.error("src/wcwidth.c is up to date");
422+
} else {
423+
await Deno.writeTextFile("src/wcwidth.c", output);
424+
console.error("Wrote src/wcwidth.c");
425+
}

0 commit comments

Comments
 (0)