Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.cli = void 0; const path = require("path"); const commander_1 = require("commander"); const packageJson = require("../package.json"); const listRoutes_1 = require("./run/listRoutes"); const startServer_1 = require("./run/startServer"); const startServerFromConfig_1 = require("./run/startServerFromConfig"); const cli = (cliArgs) => { commander_1.program .version(packageJson.version, '-v, --version', 'output the current version') .option('-p, --port <number>', 'port to serve Restapify instance') .option('-b, --baseUrl <string>', 'base url to serve the API') .option('-o, --open', 'open dashboard on server start', true) .option('--no-open', 'don\'t open dashboard on server start'); commander_1.program .command('serve <rootDir>') .description('serve a mocked API from folder <rootDir>') .action((rootDir, options) => { startServer_1.startServer({ rootDir: path.resolve(rootDir), baseUrl: options.parent.baseUrl, port: options.parent.port, openDashboard: options.parent.open }); }); commander_1.program .command('list <rootDir>') .description('list all routes to serve from folder <rootDir>') .action((rootDir) => { listRoutes_1.listRoutes(path.resolve(rootDir)); }); commander_1.program .arguments('[pathToConfig]') .action((pathToConfig = './restapify.config.json') => { startServerFromConfig_1.startServerFromConfig(path.resolve(pathToConfig)); }); commander_1.program.parse(cliArgs); }; exports.cli = cli; |