@tsed/cli-core
Version:
Build your CLI with TypeScript and Decorators
30 lines (29 loc) • 845 B
JavaScript
import { __decorate, __metadata } from "tslib";
import { Inject } from "@tsed/di";
import { Observable } from "rxjs";
import { CliExeca } from "../../services/CliExeca.js";
export class BaseManager {
constructor() {
this.verboseOpt = "--verbose";
}
has() {
try {
this.cliExeca.runSync(this.cmd, ["--version"]);
return true;
}
catch (er) {
return false;
}
}
async init(opts) { }
runScript(script, options) {
return this.run("run", [script], options);
}
run(cmd, args, options) {
return this.cliExeca.run(this.cmd, [cmd, options.verbose && this.verboseOpt, ...args].filter(Boolean), options);
}
}
__decorate([
Inject(CliExeca),
__metadata("design:type", CliExeca)
], BaseManager.prototype, "cliExeca", void 0);