UNPKG

actionhero

Version:

The reusable, scalable, and quick node.js API server for stateless and stateful applications

28 lines (27 loc) 882 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ConsoleCLI = void 0; const REPL = require("repl"); const index_1 = require("./../../index"); class ConsoleCLI extends index_1.CLI { constructor() { super(...arguments); this.name = "console"; this.description = "Start an interactive REPL session with the api object in-scope"; } async run() { await new Promise((resolve, reject) => { const repl = REPL.start({ prompt: "[ AH::" + index_1.env + " ] >> ", input: process.stdin, output: process.stdout, useGlobal: false, }); repl.context.api = index_1.api; repl.on("exit", resolve); repl.on("error", reject); }); return true; } } exports.ConsoleCLI = ConsoleCLI;