File tree Expand file tree Collapse file tree 1 file changed +10
-13
lines changed Expand file tree Collapse file tree 1 file changed +10
-13
lines changed Original file line number Diff line number Diff line change @@ -4,9 +4,11 @@ const ora = require('ora');
44const { EOL } = require ( 'os' ) ;
55const chalk = require ( 'chalk' ) ;
66const read = require ( 'read' ) ;
7- const { IGNORE } = require ( './run ' ) ;
7+ const inquirer = require ( 'inquirer ' ) ;
88
9+ const { IGNORE } = require ( './run' ) ;
910const { warning, error, info, success } = require ( './figures' ) ;
11+
1012const FIGURE_INDENT = ' ' ;
1113const EOL_INDENT = `${ EOL } ${ FIGURE_INDENT } ` ;
1214
@@ -47,19 +49,14 @@ class CLI {
4749 }
4850
4951 async prompt ( question , defaultAnswer = true ) {
50- const option =
51- `[${ ( defaultAnswer ? 'Y' : 'y' ) } /${ ( defaultAnswer ? 'n' : 'N' ) } ]` ;
5252 this . separator ( ) ;
53- const promptText = `${ chalk . bold . cyan ( '?' ) } ${ question } ${ option } ` ;
54-
55- const answer = await this . promptForInput ( promptText ) ;
56- const trimmed = answer . toLowerCase ( ) . trim ( ) ;
57- if ( ! trimmed ) {
58- return defaultAnswer ;
59- } else if ( trimmed === 'y' ) {
60- return true ;
61- }
62- return false ;
53+ const { answer } = await inquirer . prompt ( [ {
54+ type : 'confirm' ,
55+ name : 'answer' ,
56+ message : question ,
57+ default : defaultAnswer
58+ } ] ) ;
59+ return answer ;
6360 }
6461
6562 startSpinner ( text ) {
You can’t perform that action at this time.
0 commit comments