UNPKG

@auttam/easycli

Version:

A quick and easy way of creating cli for your npm package.

31 lines (30 loc) 1.11 kB
import { Collection } from './collection'; import { Config } from './base-config'; import { ParamCollection, IParamConfig } from './param-config'; import { IOptionConfig, OptionCollection } from './option-config'; export interface ICommandConfig { method: string; name?: string; help?: string; params?: IParamConfig[]; options?: IOptionConfig[]; } export declare class Command extends Config { params: ParamCollection; options: OptionCollection; constructor(config: ICommandConfig); toCommandConfig(): ICommandConfig; merge(config: ICommandConfig): void; } export declare class CommandCollection extends Collection<Command> { private _definedNames; add(config: ICommandConfig): void; addByCommand(command: Command): void; addMethod(name: string, methodSignature: any): void; addList(configs?: ICommandConfig[]): void; protected validate(item: Command): void; protected itemAdded(item: Command): void; getByName(name: string): Command; hasMethod(methodName: string): boolean | undefined; verify(): void; }