UNPKG

ffbt

Version:

Build a Typescript app without pain

33 lines (32 loc) 997 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.BaseCommand = void 0; const tslib_1 = require("tslib"); const command_1 = require("@oclif/command"); const chalk_1 = require("chalk"); class BaseCommand extends command_1.Command { getArguments() { const { args } = this.parse(this.constructor); return args; } getFlags() { const { flags } = this.parse(this.constructor); return flags; } catch(error) { return tslib_1.__awaiter(this, void 0, void 0, function* () { const { verbose } = this.getFlags(); const errorInfo = verbose ? String(error.stack) : error.message; console.log(chalk_1.redBright(errorInfo)); }); } } exports.BaseCommand = BaseCommand; BaseCommand.flags = { verbose: command_1.flags.boolean({ default: false, description: "shows details about the results of running command", }) };