UNPKG

@tsed/cli-core

Version:
26 lines (25 loc) 717 B
import { inject } from "@tsed/di"; import { Observable } from "rxjs"; import { CliExeca } from "../../services/CliExeca.js"; export class BaseManager { constructor() { this.verboseOpt = "--verbose"; this.cliExeca = inject(CliExeca); } 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); } }