File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ import { convertGBToMB } from '../../../utils/unit-conversions.js';
88import { RESULT_TYPE_INFO } from '../../../constants/messages.constants.js' ;
99import { IConfig } from '../../../cli/interfaces/config.interface.js' ;
1010import { COLORS } from '../../../constants/cli.constants.js' ;
11+ import { OPTIONS_HINTS_BY_TYPE } from '../../../constants/options.constants.js' ;
1112
1213type OptionType = 'checkbox' | 'dropdown' | 'input' ;
1314
@@ -187,6 +188,7 @@ export class OptionsUi extends BaseUi implements InteractiveUi {
187188
188189 render ( ) : void {
189190 this . clear ( ) ;
191+ this . printHintMessage ( ) ;
190192 let currentRow = MARGINS . ROW_RESULTS_START ;
191193
192194 this . printAt ( colors . bold . bgYellow . black ( ' OPTIONS ' ) , {
@@ -236,6 +238,24 @@ export class OptionsUi extends BaseUi implements InteractiveUi {
236238 }
237239 }
238240
241+ private printHintMessage ( ) {
242+ const optionSelected = this . options [ this . selectedIndex ] ;
243+
244+ const hintText =
245+ optionSelected . type === 'input' && this . isEditing
246+ ? OPTIONS_HINTS_BY_TYPE [ 'input-exit' ]
247+ : OPTIONS_HINTS_BY_TYPE [ optionSelected . type ] ;
248+
249+ if ( ! hintText ) {
250+ return ;
251+ }
252+
253+ this . printAt ( hintText , {
254+ x : 15 ,
255+ y : MARGINS . ROW_RESULTS_START ,
256+ } ) ;
257+ }
258+
239259 clear ( ) : void {
240260 for ( let row = MARGINS . ROW_RESULTS_START ; row < this . terminal . rows ; row ++ ) {
241261 this . clearLine ( row ) ;
Original file line number Diff line number Diff line change @@ -5,3 +5,4 @@ export * from './sort.result.js';
55export * from './spinner.constants.js' ;
66export * from './update.constants.js' ;
77export * from './recursive-rmdir-node-support.constants.js' ;
8+ export * from './options.constants.js' ;
Original file line number Diff line number Diff line change 1+ import colors from 'colors' ;
2+
3+ export const OPTIONS_HINTS_BY_TYPE = {
4+ input : colors . gray (
5+ `${ colors . bold . underline ( 'SPACE' ) } or ${ colors . bold . underline ( 'ENTER' ) } to edit.` ,
6+ ) ,
7+ 'input-exit' : colors . gray (
8+ `${ colors . bold . underline ( 'ENTER' ) } to confirm. ${ colors . bold . underline ( 'ESC' ) } To cancel.` ,
9+ ) ,
10+ dropdown : colors . gray (
11+ `${ colors . bold . underline ( 'SPACE' ) } /${ colors . bold . underline ( 'SHIFT' ) } +${ colors . bold . underline ( 'SPACE' ) } to navigate.` ,
12+ ) ,
13+ checkbox : colors . gray (
14+ `${ colors . bold . underline ( 'SPACE' ) } or ${ colors . bold . underline ( 'ENTER' ) } to toggle.` ,
15+ ) ,
16+ } ;
You can’t perform that action at this time.
0 commit comments