@mornya/cli-libs
Version:
The project of the utilities for CLI.
25 lines (24 loc) • 750 B
TypeScript
type HasName = string | {
test: RegExp;
key?: string;
};
export type KeyValueFlag<K extends string, T = string> = {
[Key in K]: T;
};
export type CommandProps = {
action: string;
alias?: string;
};
export type ActionMap<K extends string> = KeyValueFlag<K, CommandProps>;
export interface IArguments {
action: string;
args: string[];
isAliased: boolean;
isUnknown: boolean;
availCommands: CommandProps[];
}
export declare function parse(): string[];
export declare function has(name: HasName): boolean;
export declare function hasAll<Keys extends string, T = KeyValueFlag<Keys>>(names: HasName[]): T;
export declare function getArguments<Keys extends string>(actionMap: ActionMap<Keys>): IArguments;
export {};