UNPKG

@codingtools/cdt

Version:
40 lines 1.7 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const tslib_1 = require("tslib"); const command_1 = require("@oclif/command"); const chalk_1 = tslib_1.__importDefault(require("chalk")); const shelljs_1 = tslib_1.__importDefault(require("shelljs")); const logger_1 = tslib_1.__importDefault(require("../utilities/logger")); const utilities_1 = tslib_1.__importDefault(require("../utilities/utilities")); /* * this Commands add support for cron jobs * */ class Run extends command_1.Command { // only 2 parameters required HASH_TYPE and INPUT_STRING async run() { const { args, flags } = this.parse(Run); args.string = utilities_1.default.getInputStringFromCmd(this, flags, args); // from either -s or args //check params after evaluating all this.checkParameters(flags, args); this.evalRun(flags, args); } // to check required parameters passed or not // tslint:disable-next-line:no-unused checkParameters(flags, args) { if (args.string === undefined || args.string === '') logger_1.default.error(this, 'Command empty or undefined'); } // tslint:disable-next-line:no-unused evalRun(flags, args) { logger_1.default.success(this, `running: ${chalk_1.default.green(args.string)}`); shelljs_1.default.exec(args.string); } } exports.default = Run; Run.description = 'Cron Expressions helper and scheduler'; Run.flags = { help: command_1.flags.help({ char: 'h' }), string: command_1.flags.string({ char: 's', description: 'command to execute, should be compatible with your shell' }), }; Run.args = [{ name: 'string' }]; //# sourceMappingURL=run.js.map