eyereasoner
Version:
Distributing the [EYE](https://github.com/eyereasoner/eye) reasoner for browser and node using WebAssembly.
28 lines (27 loc) • 1.06 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.mainFunc = mainFunc;
const path_1 = __importDefault(require("path"));
const fs_1 = __importDefault(require("fs"));
const readline_1 = __importDefault(require("readline"));
const __1 = require("..");
const query_1 = require("../query");
async function mainFunc(proc) {
const rl = readline_1.default.promises.createInterface({
input: proc.stdin,
output: proc.stdout,
});
const Module = await (0, __1.SwiplEye)();
// Make any local files available to the reasoner
for (const arg of proc.argv.slice(2)) {
const p = path_1.default.join(proc.cwd(), arg);
if (fs_1.default.existsSync(p)) {
Module.FS.writeFile(arg, fs_1.default.readFileSync(p));
}
}
await (0, query_1.qaQuery)(Module, 'main', proc.argv.slice(2), (q) => rl.question(`${q}\n|: `));
rl.close();
}