@sprucelabs/spruce-cli
Version:
Command line interface for building Spruce skills.
55 lines • 1.73 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
class MockProgramFactory {
constructor() { }
static Program() {
// @ts-ignore
return {
_lastCommand: '',
commandInvocations: [],
descriptionInvocations: [],
actionInvocations: [],
optionInvocations: [],
aliasesInvocations: [],
commands: [],
actionHandler: async (_options) => { },
command(str) {
this.commandInvocations.push(str);
this._lastCommand = str;
return this;
},
//@ts-ignore
description(str) {
this.descriptionInvocations.push({
command: this._lastCommand,
description: str,
});
return this;
},
//@ts-ignore
aliases(aliases) {
this.aliasesInvocations.push(...aliases);
return this;
},
action(cb) {
this.actionInvocations.push(this._lastCommand);
this.actionHandler = async (options) => {
await cb(options, {});
};
return this;
},
//@ts-ignore
option(option, hint, defaultValue) {
this.optionInvocations.push({
command: this._lastCommand,
option,
hint,
defaultValue,
});
return this;
},
};
}
}
exports.default = MockProgramFactory;
//# sourceMappingURL=MockProgramFactory.js.map