speedrun-cli 2.7.3 → 2.7.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/utils.js +9 -5
package/package.json
CHANGED
package/src/utils.js
CHANGED
|
@@ -115,9 +115,13 @@ function registerStrictConfirmPrompt(inquirerInstance = require('inquirer')) {
|
|
|
115
115
|
class StrictConfirmPrompt extends InputPrompt {
|
|
116
116
|
constructor(questions, rl, answers) {
|
|
117
117
|
super(questions, rl, answers);
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
118
|
+
this.defaultBool = this.opt.default !== false;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
getQuestion() {
|
|
122
|
+
let message = super.getQuestion();
|
|
123
|
+
// Remove auto-appended (true) or (false) text from InputPrompt
|
|
124
|
+
return message.replace(/\s*\((true|false)\)\s*/g, ' ');
|
|
121
125
|
}
|
|
122
126
|
|
|
123
127
|
render(answer) {
|
|
@@ -126,7 +130,7 @@ function registerStrictConfirmPrompt(inquirerInstance = require('inquirer')) {
|
|
|
126
130
|
if (this.status === 'answered') {
|
|
127
131
|
message += chalk.cyan(answer !== undefined ? (answer ? 'Yes' : 'No') : (this.answer ? 'Yes' : 'No'));
|
|
128
132
|
} else {
|
|
129
|
-
message += chalk.dim(this.
|
|
133
|
+
message += chalk.dim(this.defaultBool ? ' (Y/n)' : ' (y/N)');
|
|
130
134
|
}
|
|
131
135
|
|
|
132
136
|
let bottomContent = '';
|
|
@@ -150,7 +154,7 @@ function registerStrictConfirmPrompt(inquirerInstance = require('inquirer')) {
|
|
|
150
154
|
|
|
151
155
|
filterInput(input) {
|
|
152
156
|
if (input === undefined || input === null || input.toString().trim() === '') {
|
|
153
|
-
return this.
|
|
157
|
+
return this.defaultBool;
|
|
154
158
|
}
|
|
155
159
|
const val = input.toString().trim().toLowerCase();
|
|
156
160
|
return ['y', 'yes'].includes(val);
|