2022-09-18 15:14:32 +00:00
|
|
|
#!/usr/bin/env node
|
|
|
|
import fs from "fs";
|
|
|
|
|
|
|
|
import { Command } from "commander";
|
|
|
|
|
2022-09-19 20:55:32 +00:00
|
|
|
import { run } from "./lib.mjs";
|
2022-09-18 15:14:32 +00:00
|
|
|
|
|
|
|
const program = new Command();
|
|
|
|
|
|
|
|
program.option("-o, --output");
|
|
|
|
program.arguments("<string>");
|
|
|
|
|
|
|
|
const options = program.parse(process.argv);
|
|
|
|
|
|
|
|
const sampleCount = process.env.SAMPLE_COUNT;
|
|
|
|
|
|
|
|
const src = fs.readFileSync(program.args[0], "utf-8");
|
|
|
|
if (!src) {
|
|
|
|
throw new Error("Expected src");
|
|
|
|
}
|
|
|
|
|
2022-09-19 20:55:32 +00:00
|
|
|
run(src, { output: options.output, sampleCount });
|