UNPKG

1.06 kBTypeScriptView Raw
1import { ICachedCommand, ICLIConfig, IConfig, IEngine, IPlugin, ITopic } from '@dxcli/config';
2export interface LoadOptions {
3 resetCache?: boolean;
4}
5export default class Engine implements IEngine {
6 config: ICLIConfig;
7 private readonly _plugins;
8 private readonly _commands;
9 private readonly _topics;
10 private readonly _hooks;
11 private debug;
12 readonly plugins: IPlugin[];
13 readonly topics: ITopic[];
14 readonly commands: ICachedCommand[];
15 readonly commandIDs: string[];
16 readonly rootTopics: ITopic[];
17 readonly rootCommands: ICachedCommand[];
18 load(config: IConfig, loadOptions?: LoadOptions): Promise<void>;
19 findCommand(id: string, must: true): ICachedCommand;
20 findCommand(id: string, must?: true): ICachedCommand | undefined;
21 findTopic(name: string, must: true): ITopic;
22 findTopic(name: string, must?: boolean): ITopic | undefined;
23 runHook<T extends {}>(event: string, opts: T): Promise<void>;
24 protected loadCommands(plugin: IPlugin, loadOptions: LoadOptions): Promise<ICachedCommand[]>;
25}