UNPKG

@anycli/command

Version:
51 lines (50 loc) 1.46 kB
import * as Config from '@anycli/config'; import * as Parser from '@anycli/parser'; import * as flags from './flags'; export default abstract class Command { argv: string[]; static _base: string; static id: string; static title: string | undefined; static description: string | undefined; static hidden: boolean; static usage: string | string[] | undefined; static help: string | undefined; static aliases: string[]; static strict: boolean; static parse: boolean; static flags: flags.Input<any>; static args: Parser.args.IArg[]; static plugin: Config.IPlugin | undefined; static examples: string[] | undefined; static parserOptions: {}; /** * instantiate and run the command */ static run: Config.Command.Full['run']; config: Config.IConfig; flags: { [name: string]: any; }; args: { [name: string]: any; }; description: null; hidden: null; usage: null; aliases: null; title: null; strict: null; examples: null; protected debug: (...args: any[]) => void; constructor(argv: string[], options: Config.Options); readonly ctor: typeof Command; readonly http: any; /** * actual command run code goes here */ abstract run(): Promise<any>; protected init(): Promise<void>; protected catch(err: Error): Promise<void>; protected finally(_: Error | undefined): Promise<void>; }