@towercg2/cli
Version:
The command-line components for TowerCG2's server.
29 lines (28 loc) • 966 B
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const clime_1 = require("clime");
const path_1 = __importDefault(require("path"));
const root = path_1.default.resolve(`${__dirname}/../..`);
async function run() {
const cli = new clime_1.CLI("towercg2", `${__dirname}/commands`);
const shim = new clime_1.Shim(cli);
try {
const result = await cli.execute(process.argv.slice(2), root);
if (clime_1.isPrintable(result)) {
await result.print(process.stdout, process.stderr);
}
else if (result !== undefined) {
console.log(result);
}
}
catch (error) {
if (clime_1.isPrintable(error)) {
await error.print(process.stdout, process.stderr);
}
process.exit(1);
}
}
exports.run = run;