@trenskow/reader 0.1.88 → 0.1.90
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/lib/interview.js +9 -3
- package/package.json +5 -5
package/lib/interview.js
CHANGED
|
@@ -115,8 +115,14 @@ const interview = async (schema, {
|
|
|
115
115
|
print.tty.nn('\x1b[0m');
|
|
116
116
|
}
|
|
117
117
|
|
|
118
|
+
let defaultValue = schema.default;
|
|
119
|
+
|
|
120
|
+
if (typeof defaultValue !== 'undefined' && schema.type === Boolean) {
|
|
121
|
+
defaultValue = defaultValue ? strings?.boolean?.yes || 'yes' : strings?.boolean?.no || 'no';
|
|
122
|
+
}
|
|
123
|
+
|
|
118
124
|
const answer = initial || await question(`${schema.label}${schema.required ? ` ${strings?.required || '(required)'}` : ''}: `, {
|
|
119
|
-
defaultValue
|
|
125
|
+
defaultValue,
|
|
120
126
|
input,
|
|
121
127
|
output,
|
|
122
128
|
silent: schema.silent === true
|
|
@@ -130,8 +136,8 @@ const interview = async (schema, {
|
|
|
130
136
|
|
|
131
137
|
if (schema.type !== Boolean) return data;
|
|
132
138
|
|
|
133
|
-
if ([
|
|
134
|
-
if ([
|
|
139
|
+
if ([strings?.boolean?.yes || 'yes', 'true', '1'].includes(String(data).toLowerCase())) return true;
|
|
140
|
+
if ([strings?.boolean?.no || 'no', 'false', '0'].includes(String(data).toLowerCase())) return false;
|
|
135
141
|
|
|
136
142
|
return data;
|
|
137
143
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trenskow/reader",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.90",
|
|
4
4
|
"description": "A simple package to ask questions of a stream.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -27,13 +27,13 @@
|
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@eslint/eslintrc": "^3.3.5",
|
|
29
29
|
"@eslint/js": "^10.0.1",
|
|
30
|
-
"eslint": "^10.
|
|
30
|
+
"eslint": "^10.4.0",
|
|
31
31
|
"globals": "^17.6.0"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@trenskow/print": "^0.1.
|
|
35
|
-
"isvalid": "^5.0.
|
|
36
|
-
"keyd": "^2.1.
|
|
34
|
+
"@trenskow/print": "^0.1.55",
|
|
35
|
+
"isvalid": "^5.0.2",
|
|
36
|
+
"keyd": "^2.1.57",
|
|
37
37
|
"puqeue": "^1.1.31"
|
|
38
38
|
}
|
|
39
39
|
}
|