@@ -120,6 +120,15 @@ export const multiselect = <Value>(opts: MultiSelectOptions<Value>) => {
120120 ) ;
121121 } ;
122122 const required = opts . required ?? true ;
123+ const hint =
124+ ' ' +
125+ color . reset (
126+ color . dim (
127+ `Press ${ color . gray ( color . bgWhite ( color . inverse ( ' space ' ) ) ) } to select, ${ color . gray (
128+ color . bgWhite ( color . inverse ( ' enter ' ) ) ,
129+ ) } to submit`,
130+ ) ,
131+ ) ;
123132
124133 return new MultiSelectPrompt ( {
125134 options : opts . options ,
@@ -131,13 +140,7 @@ export const multiselect = <Value>(opts: MultiSelectOptions<Value>) => {
131140 cursorAt : opts . cursorAt ,
132141 validate ( selected : Value [ ] | undefined ) {
133142 if ( required && ( selected === undefined || selected . length === 0 ) ) {
134- return `Please select at least one option.\n${ color . reset (
135- color . dim (
136- `Press ${ color . gray ( color . bgWhite ( color . inverse ( ' space ' ) ) ) } to select, ${ color . gray (
137- color . bgWhite ( color . inverse ( ' enter ' ) ) ,
138- ) } to submit`,
139- ) ,
140- ) } `;
143+ return `Please select at least one option.\n${ hint } ` ;
141144 }
142145 return undefined ;
143146 } ,
@@ -221,7 +224,7 @@ export const multiselect = <Value>(opts: MultiSelectOptions<Value>) => {
221224 columnPadding : prefix . length ,
222225 rowPadding : titleLineCount + footerLineCount ,
223226 style : styleOption ,
224- } ) . join ( `\n${ prefix } ` ) } \n${ footer } \n`;
227+ } ) . join ( `\n${ prefix } ` ) } \n${ hint } \n ${ footer } \n`;
225228 }
226229 default : {
227230 const prefix = hasGuide ? `${ color . blue ( S_BAR ) } ` : nestedPrefix ;
@@ -236,7 +239,7 @@ export const multiselect = <Value>(opts: MultiSelectOptions<Value>) => {
236239 columnPadding : prefix . length ,
237240 rowPadding : titleLineCount + footerLineCount ,
238241 style : styleOption ,
239- } ) . join ( `\n${ prefix } ` ) } \n${ hasGuide ? color . blue ( S_BAR_END ) : '' } \n`;
242+ } ) . join ( `\n${ prefix } ` ) } \n${ hint } \n ${ hasGuide ? color . blue ( S_BAR_END ) : '' } \n`;
240243 }
241244 }
242245 } ,
0 commit comments