srap/bin/simulate

32 lines
712 B
Plaintext
Raw Permalink Normal View History

2021-03-18 23:49:16 +01:00
#!/usr/bin/env node
"use strict";
const Promise = require("bluebird");
const yargs = require("yargs");
const path = require("path");
const createKernel = require("../src/kernel");
const chalk = require("chalk");
let argv = yargs.argv;
let [ configurationPath, task, item ] = argv._;
2023-02-09 02:08:29 +01:00
let absoluteConfigurationPath = path.resolve(process.cwd(), configurationPath);
2021-03-18 23:49:16 +01:00
let configuration = require(absoluteConfigurationPath);
return Promise.try(() => {
return createKernel(configuration);
}).then((kernel) => {
return Promise.try(() => {
return kernel.simulate({
task: task,
itemID: item
});
}).then(() => {
console.log(chalk.green.bold("Done!"));
}).finally(() => {
kernel.shutdown();
});
});