squiggle/packages/squiggle-lang/scripts/run-file.mjs

23 lines
459 B
JavaScript
Raw Permalink Normal View History

#!/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";
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 });