UNPKG

@unito/integration-cli

Version:

Integration CLI

40 lines (39 loc) 1.26 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.BaseCommand = void 0; const core_1 = require("@oclif/core"); class BaseCommand extends core_1.Command { // add the --json flag static enableJsonFlag = true; flags; args; async init() { await super.init(); const { args, flags } = await this.parse({ flags: this.ctor.flags, args: this.ctor.args, strict: this.ctor.strict, }); this.flags = flags; this.args = args; } // istanbul ignore next async run() { // emit analytics await this.config.runHook('checkConfig', { id: 'my_command' }); } // istanbul ignore next // eslint-disable-next-line @typescript-eslint/no-explicit-any async catch(err) { // add any custom logic to handle errors from the command // or simply return the parent class error handling return super.catch(err); } // istanbul ignore next // eslint-disable-next-line @typescript-eslint/no-explicit-any async finally(_) { // called after execution and catching up, whether the command was wrong or not return super.finally(_); } } exports.BaseCommand = BaseCommand;