import { Command } from './command'; import { Hooks } from './hooks'; import { PJSON } from './pjson'; import * as Plugin from './plugin'; import { Topic } from './topic'; export declare type PlatformTypes = 'darwin' | 'linux' | 'win32' | 'aix' | 'freebsd' | 'openbsd' | 'sunos'; export declare type ArchTypes = 'arm' | 'arm64' | 'mips' | 'mipsel' | 'ppc' | 'ppc64' | 's390' | 's390x' | 'x32' | 'x64' | 'x86'; export interface Options extends Plugin.Options { devPlugins?: boolean; userPlugins?: boolean; } export interface IConfig { pjson: PJSON.CLI; /** * process.arch */ arch: ArchTypes; /** * bin name of CLI command */ bin: string; /** * cache directory to use for CLI * * example ~/Library/Caches/mycli or ~/.cache/mycli */ cacheDir: string; /** * config directory to use for CLI * * example: ~/.config/mycli */ configDir: string; /** * data directory to use for CLI * * example: ~/.local/share/mycli */ dataDir: string; /** * base dirname to use in cacheDir/configDir/dataDir */ dirname: string; /** * points to a file that should be appended to for error logs * * example: ~/Library/Caches/mycli/error.log */ errlog: string; /** * path to home directory * * example: /home/myuser */ home: string; /** * process.platform */ platform: PlatformTypes; /** * active shell */ shell: string; /** * user agent to use for http calls * * example: mycli/1.2.3 (darwin-x64) node-9.0.0 */ userAgent: string; /** * if windows */ windows: boolean; /** * debugging level * * set by ${BIN}_DEBUG or DEBUG=$BIN */ debug: number; /** * npm registry to use for installing plugins */ npmRegistry: string; userPJSON?: PJSON.User; plugins: Plugin.IPlugin[]; commands: Command.Plugin[]; readonly commandIDs: string[]; runCommand(id: string, argv?: string[]): Promise; runHook(event: K, opts: T[K]): Promise; findCommand(id: string, opts: { must: true; }): Command.Plugin; findCommand(id: string, opts?: { must: boolean; }): Command.Plugin | undefined; findTopic(id: string, opts: { must: true; }): Topic; findTopic(id: string, opts?: { must: boolean; }): Topic | undefined; } export declare class Config implements IConfig { _base: string; name: string; version: string; root: string; arch: ArchTypes; bin: string; cacheDir: string; configDir: string; dataDir: string; dirname: string; errlog: string; home: string; platform: PlatformTypes; shell: string; windows: boolean; userAgent: string; debug: number; npmRegistry: string; pjson: PJSON.CLI; userPJSON?: PJSON.User; plugins: Plugin.IPlugin[]; commands: Command.Plugin[]; topics: Topic[]; protected warned: boolean; constructor(opts: Options); runHook(event: K, opts: T[K]): Promise; runCommand(id: string, argv?: string[]): Promise; scopedEnvVar(k: string): string | undefined; scopedEnvVarTrue(k: string): boolean; scopedEnvVarKey(k: string): string; findCommand(id: string, opts: { must: true; }): Command.Plugin; findCommand(id: string, opts?: { must: boolean; }): Command.Plugin | undefined; findTopic(id: string, opts: { must: true; }): Topic; findTopic(id: string, opts?: { must: boolean; }): Topic | undefined; readonly commandIDs: string[]; protected dir(category: 'cache' | 'data' | 'config'): string; protected windowsHome(): string | undefined; protected windowsHomedriveHome(): string | undefined; protected windowsUserprofileHome(): string | undefined; protected macosCacheDir(): string | undefined; protected _shell(): string; protected _debug(): number; protected loadPlugins(root: string, type: string, plugins: (string | { root?: string; name?: string; tag?: string; })[], options?: { must?: boolean; }): void; protected addMissingTopics(): void; protected warn(err: any, scope?: string): void; } export declare type LoadOptions = Options | string | IConfig | undefined; export declare function load(opts?: LoadOptions): IConfig;