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 43 44 45 46 47 | "use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.execute = void 0; const cognigyClient_1 = __importDefault(require("../utils/cognigyClient")); const execute = async ({ command, options, stdin }) => { let data = null; if (options.list) { const commands = []; Object.keys(cognigyClient_1.default).forEach((key) => { commands.push(key); }); commands.sort(); console.log(`cognigy execute supports the following ${commands.length} commands:\n`); console.log('- ' + commands.join('\n- ')); process.exit(0); } if (!command) { console.log(`error: Missing paramter 'command'`); process.exit(0); } if (Object.keys(cognigyClient_1.default).indexOf(command) === -1) { console.log(`error: Command '${command}' doesn't exist. Please execute 'cognigy execute -l' to see a list of available commands`); process.exit(0); } try { if (stdin) data = JSON.parse(stdin); if (options.data) data = JSON.parse(options.data); } catch (err) { console.log(`error: ${err.message}`); process.exit(0); } try { console.log(JSON.stringify(await cognigyClient_1.default[command](data), undefined, 4)); } catch (err) { console.log(`error: ${err.message}`); } return; }; exports.execute = execute; |