prompts-helpers
v2.0.1
Published
Collection of convenience helpers for Prompts.
Downloads
15
Maintainers
Readme
Prompts Helpers
Collection of convenience helpers for Prompts.
Install
npm install --save prompts-helpers
Usage
The following methods are provided:
type confirm = ( message: string, initial: boolean = false ) => Promise<boolean>;
type noYes = ( message: string ) => Promise<boolean>;
type yesNo = ( message: string ) => Promise<boolean>;
type date = ( message: string, initial?: Date, validate?: (( value: Date ) => boolean | string) ) => Promise<Date | false>;
type number = ( message: string, max: number, min: number, validate?: (( value: number ) => boolean | string) ) => Promise<number | false>;
type password = ( message: string, validate?: (( value: string ) => boolean | string) ) => Promise<string | false>;
type text = ( message: string, validate?: (( value: string ) => boolean | string) ) => Promise<string | false>;
type select = <T extends string> ( message: string, choices: T[] ) => Promise<T | false>;
type multiselect = <T extends string> ( message: string, choices: T[], max: number = Infinity ) => Promise<T[] | false>;
type spinner = ( message: string ) => Spinner;
Check actual examples here.
License
MIT © Fabio Spampinato