@nodearch/command
Version:
NodeArch Command Toolkit
53 lines • 1.71 kB
TypeScript
import { QuestionType } from './enums.js';
import { ICommandModule } from './yargs.interfaces.js';
export type CommandAnswers = Record<string, any>;
export type CommandQuestionsDefault = string | number | boolean | Array<any> | {
(answers: CommandAnswers): string | number | boolean | Array<any>;
};
export type CommandQuestionsChoices = string | number | {
name?: string;
value?: any;
short?: string;
extra?: any;
};
export interface CommandQuestion<T = any> extends Record<string, any> {
type: QuestionType;
name: string;
message?: string | {
(answers: CommandAnswers): string;
};
default?: CommandQuestionsDefault;
choices?: CommandQuestionsChoices[] | {
(answers?: CommandAnswers): Promise<CommandQuestionsChoices[]>;
};
validate?(input: any, answers?: CommandAnswers): boolean | string | Promise<boolean | string>;
filter?(input: any, answers?: CommandAnswers): any;
transformer?(input: any, answers: CommandAnswers, flags: {
isFinal?: boolean;
}): string | Promise<string>;
when?: boolean | {
(answers: CommandAnswers): boolean;
};
pageSize?: number;
prefix?: string;
suffix?: string;
askAnswered?: boolean;
loop?: boolean;
}
export interface INotificationService {
notify(message: string): void;
}
export interface ICommand<T = any> extends ICommandModule<T> {
questions?: CommandQuestion[];
}
export declare enum NpmDependencyType {
Dependency = "dep",
DevDependency = "dev"
}
export interface INpmDependency {
name: string;
version?: string;
type?: NpmDependencyType;
when?: (data: any) => boolean;
}
//# sourceMappingURL=interfaces.d.ts.map