UNPKG

@villedemontreal/scripting

Version:
40 lines 1.71 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.TestingCallingScript = void 0; const core_1 = require("@caporal/core"); const src_1 = require("../../src"); const testingExampleScript_1 = require("./testingExampleScript"); const testingScriptWithArgs_1 = require("./testingScriptWithArgs"); class TestingCallingScript extends src_1.ScriptBase { get name() { return `${src_1.TESTING_SCRIPT_NAME_PREFIX}testingCallingScript`; } get description() { return `A script that invokes another script.`; } async configure(command) { command.option(`--foo <number>`, `A foo number`, { required: true, validator: core_1.program.NUMBER, }); command.option(`--bar [text]`, `A bar text`, { validator: core_1.program.STRING, }); command.option(`--delay [number]`, `A delay`, { validator: core_1.program.NUMBER, }); command.option(`--throwError`, `Throw an error`); command.option(`--forceVerboseToFalse`, `Force --verbose to false when calling another script.`); } async main() { await this.invokeScript(testingScriptWithArgs_1.TestingScriptWithArgs, { port: this.options.foo, delay: this.options.delay, throwError: this.options.throwError, ...(this.options.forceVerboseToFalse ? { verbose: false } : {}), }, { name: this.options.bar ?? 'MyService' }); await this.invokeScript(testingExampleScript_1.TestingExampleScript, { lucky: this.options.foo }, {}); } } exports.TestingCallingScript = TestingCallingScript; //# sourceMappingURL=testingCallingScript.js.map