///
import { Opts as ParseArgsOptions, ParsedArgs } from 'minimist';
export declare type ParsedArg = string | boolean | null | undefined | string[];
export declare type Validator = (input?: string, key?: string) => true | string;
export declare type CommandLineInputs = string[];
export interface CommandLineOptions extends ParsedArgs {
[arg: string]: ParsedArg;
}
export declare type CommandOptionType = StringConstructor | BooleanConstructor;
export interface CommandMetadataInput {
name: string;
summary: string;
validators?: Validator[];
private?: boolean;
}
export interface TextFootnote {
id: string | number;
text: string;
}
export interface LinkFootnote {
id: string | number;
url: string;
shortUrl?: string;
}
export declare type Footnote = TextFootnote | LinkFootnote;
export declare const enum MetadataGroup {
ADVANCED = "advanced",
BETA = "beta",
DEPRECATED = "deprecated",
EXPERIMENTAL = "experimental",
HIDDEN = "hidden",
PAID = "paid"
}
export interface Metadata {
name: string;
summary: string;
description?: string;
footnotes?: Footnote[];
groups?: string[];
}
export interface CommandMetadataOption extends Metadata {
type?: CommandOptionType;
default?: string | boolean;
aliases?: string[];
spec?: {
value?: string;
};
}
export declare type HydratedCommandMetadataOption = Readonly>;
export { ParseArgsOptions };
export interface HydratedParseArgsOptions extends ParseArgsOptions {
string: string[];
boolean: string[];
alias: {
[key: string]: string[];
};
default: {
[key: string]: string | boolean;
};
}
export interface CommandMetadata extends Metadata {
exampleCommands?: string[];
inputs?: I[];
options?: O[];
}
export interface CommandInstanceInfo, N extends INamespace, M extends CommandMetadata, I extends CommandMetadataInput, O extends CommandMetadataOption> {
location: NamespaceLocateResult;
env: NodeJS.ProcessEnv;
executor: IExecutor;
}
export interface ICommand, N extends INamespace, M extends CommandMetadata, I extends CommandMetadataInput, O extends CommandMetadataOption> {
namespace: N;
getMetadata(runinfo?: Partial>): Promise;
run(inputs: CommandLineInputs, options: CommandLineOptions, runinfo?: Partial>): Promise;
validate(argv: CommandLineInputs): Promise;
}
export declare type CommandMapGetter, N extends INamespace, M extends CommandMetadata, I extends CommandMetadataInput, O extends CommandMetadataOption> = () => Promise;
export declare type NamespaceMapGetter, N extends INamespace, M extends CommandMetadata, I extends CommandMetadataInput, O extends CommandMetadataOption> = () => Promise;
export declare type ICommandMap, N extends INamespace, M extends CommandMetadata, I extends CommandMetadataInput, O extends CommandMetadataOption> = import('@ionic/utils-object').AliasedMap>;
export declare type INamespaceMap, N extends INamespace, M extends CommandMetadata, I extends CommandMetadataInput, O extends CommandMetadataOption> = import('@ionic/utils-object').AliasedMap>;
export interface NamespaceLocateOptions {
useAliases?: boolean;
}
export interface INamespace, N extends INamespace, M extends CommandMetadata, I extends CommandMetadataInput, O extends CommandMetadataOption> {
root: N;
parent: N | undefined;
locate(argv: readonly string[], options?: NamespaceLocateOptions): Promise>;
getMetadata(): Promise;
getNamespaces(): Promise>;
getCommands(): Promise>;
getCommandMetadataList(): Promise[]>;
groupCommandsByNamespace(commands: readonly HydratedCommandMetadata[]): Promise & {
commands: readonly HydratedCommandMetadata[];
})[]>;
}
export declare type CommandPathItem, N extends INamespace, M extends CommandMetadata, I extends CommandMetadataInput, O extends CommandMetadataOption> = [string, C | N];
export interface NamespaceLocateResult, N extends INamespace, M extends CommandMetadata, I extends CommandMetadataInput, O extends CommandMetadataOption> {
readonly obj: C | N;
readonly args: readonly string[];
readonly path: readonly CommandPathItem[];
}
export declare type HydratedCommandMetadata, N extends INamespace, M extends CommandMetadata, I extends CommandMetadataInput, O extends CommandMetadataOption> = M & {
readonly command: C;
readonly namespace: N;
readonly path: readonly CommandPathItem[];
readonly aliases: readonly string[];
};
export interface NamespaceMetadata extends Metadata {
}
export interface HydratedNamespaceMetadata, N extends INamespace, M extends CommandMetadata, I extends CommandMetadataInput, O extends CommandMetadataOption> extends Required> {
readonly namespace: N;
readonly aliases: readonly string[];
}
export interface IExecutor, N extends INamespace, M extends CommandMetadata, I extends CommandMetadataInput, O extends CommandMetadataOption> {
readonly namespace: N;
locate(argv: readonly string[]): Promise>;
execute(location: NamespaceLocateResult): Promise;
execute(argv: readonly string[], env: NodeJS.ProcessEnv): Promise;
run(command: C, cmdargs: readonly string[], runinfo?: Partial>): Promise;
}
export interface PackageJson {
name: string;
version: string;
main?: string;
description?: string;
bin?: {
[key: string]: string | undefined;
};
scripts?: {
[key: string]: string | undefined;
};
dependencies?: {
[key: string]: string | undefined;
};
devDependencies?: {
[key: string]: string | undefined;
};
}
export interface Validators {
required: Validator;
email: Validator;
numeric: Validator;
url: Validator;
slug: Validator;
}
export interface ValidationError {
key: string;
message: string;
validator: Validator;
}