UNPKG

1.61 kBTypeScriptView Raw
1import { Aliases, ManifestCommand, ManifestLoaderContract, CommandConstructorContract } from '../Contracts';
2/**
3 * The manifest loader exposes the API to load ace commands from one
4 * or more manifest files.
5 */
6export declare class ManifestLoader implements ManifestLoaderContract {
7 private files;
8 /**
9 * An array of defined manifest files
10 */
11 private manifestFiles;
12 booted: boolean;
13 constructor(files: {
14 basePath: string;
15 manifestAbsPath: string;
16 }[]);
17 /**
18 * Loads the manifest file from the disk
19 */
20 private loadManifestFile;
21 /**
22 * Returns the command manifest node for a give command
23 */
24 private getCommandManifest;
25 /**
26 * Boot manifest loader to read all manifest files from the disk
27 */
28 boot(): Promise<void>;
29 /**
30 * Returns base path for a given command
31 */
32 getCommandBasePath(commandName: string): string | undefined;
33 /**
34 * Returns manifest command node. One must load the command
35 * in order to use it
36 */
37 getCommand(commandName: string): {
38 basePath: string;
39 command: ManifestCommand;
40 } | undefined;
41 /**
42 * Find if a command exists or not
43 */
44 hasCommand(commandName: string): boolean;
45 /**
46 * Load command from the disk. Make sure to use [[hasCommand]] before
47 * calling this method
48 */
49 loadCommand(commandName: string): Promise<CommandConstructorContract>;
50 /**
51 * Returns an array of manifest commands
52 */
53 getCommands(): {
54 commands: ManifestCommand[];
55 aliases: Aliases;
56 };
57}