flagpole
Version:
Simple and fast DOM integration, headless or headful browser, and REST API testing framework.
67 lines • 2.78 kB
JavaScript
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Command = exports.CliCommandOption = void 0;
const flagpole_execution_1 = require("../flagpole-execution");
class CliCommandOption {
constructor(opts) {
this.flags = opts.flags;
this.description = opts.description;
this.default = opts.default;
this.format = opts.format;
}
}
exports.CliCommandOption = CliCommandOption;
class Command {
constructor() {
this.description = "";
this.isHidden = false;
this.isDefault = false;
this.noHelp = false;
this.options = [];
}
init(program) {
const command = program.command(this.commandString, {
hidden: this.isHidden,
noHelp: this.noHelp,
isDefault: this.isDefault,
});
this.options.forEach((option) => {
if (option.format) {
command.option(option.flags, option.description, option.format, option.default);
}
else {
command.option(option.flags, option.description, option.default);
}
});
command.description(this.description);
command.on("--help", this.helpCallback);
command.action((...args) => __awaiter(this, void 0, void 0, function* () {
flagpole_execution_1.FlagpoleExecution.global = flagpole_execution_1.FlagpoleExecution.create({
configFilePath: program.config,
environmentName: program.env,
exitOnDone: !!program.exitOnDone,
isChildProcess: !!program.isChildProcess,
baseDomain: program.base,
outputFormat: program.output,
volume: Number(program.volume || 50),
automaticallyPrintToConsole: true,
});
this.action.apply(this, args);
}));
}
action(...args) {
return __awaiter(this, void 0, void 0, function* () { });
}
helpCallback(...args) { }
}
exports.Command = Command;
//# sourceMappingURL=command.js.map
;