inquirerer 1.2.0 → 1.3.0
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/commander.js +2 -2
- package/esm/commander.js +2 -2
- package/esm/prompt.js +12 -4
- package/package.json +2 -2
- package/prompt.js +12 -4
package/commander.js
CHANGED
|
@@ -10,7 +10,7 @@ const prompt_1 = require("./prompt");
|
|
|
10
10
|
const utils_1 = require("./utils");
|
|
11
11
|
exports.defaultCLIOptions = {
|
|
12
12
|
version: `inquirerer@${(0, utils_1.getVersion)()}`,
|
|
13
|
-
noTty:
|
|
13
|
+
noTty: !process.stdout.isTTY,
|
|
14
14
|
input: process.stdin,
|
|
15
15
|
output: process.stdout,
|
|
16
16
|
minimistOpts: {
|
|
@@ -33,7 +33,7 @@ class CLI {
|
|
|
33
33
|
this.options = mergedOptions;
|
|
34
34
|
this.argv = argv ? argv : (0, minimist_1.default)(process.argv.slice(2), this.options.minimistOpts);
|
|
35
35
|
this.prompter = new prompt_1.Inquirerer({
|
|
36
|
-
noTty:
|
|
36
|
+
noTty: this.options.noTty,
|
|
37
37
|
input: this.options.input,
|
|
38
38
|
output: this.options.output
|
|
39
39
|
});
|
package/esm/commander.js
CHANGED
|
@@ -4,7 +4,7 @@ import { Inquirerer } from './prompt';
|
|
|
4
4
|
import { getVersion } from './utils';
|
|
5
5
|
export const defaultCLIOptions = {
|
|
6
6
|
version: `inquirerer@${getVersion()}`,
|
|
7
|
-
noTty:
|
|
7
|
+
noTty: !process.stdout.isTTY,
|
|
8
8
|
input: process.stdin,
|
|
9
9
|
output: process.stdout,
|
|
10
10
|
minimistOpts: {
|
|
@@ -27,7 +27,7 @@ export class CLI {
|
|
|
27
27
|
this.options = mergedOptions;
|
|
28
28
|
this.argv = argv ? argv : minimist(process.argv.slice(2), this.options.minimistOpts);
|
|
29
29
|
this.prompter = new Inquirerer({
|
|
30
|
-
noTty:
|
|
30
|
+
noTty: this.options.noTty,
|
|
31
31
|
input: this.options.input,
|
|
32
32
|
output: this.options.output
|
|
33
33
|
});
|
package/esm/prompt.js
CHANGED
|
@@ -326,8 +326,12 @@ export class Inquirerer {
|
|
|
326
326
|
});
|
|
327
327
|
}
|
|
328
328
|
async text(question, ctx) {
|
|
329
|
-
if (this.noTty || !this.rl)
|
|
330
|
-
|
|
329
|
+
if (this.noTty || !this.rl) {
|
|
330
|
+
if ('default' in question) {
|
|
331
|
+
return question.default;
|
|
332
|
+
}
|
|
333
|
+
return;
|
|
334
|
+
}
|
|
331
335
|
let input = '';
|
|
332
336
|
return new Promise((resolve) => {
|
|
333
337
|
this.clearScreen();
|
|
@@ -444,8 +448,12 @@ export class Inquirerer {
|
|
|
444
448
|
});
|
|
445
449
|
}
|
|
446
450
|
async autocomplete(question, ctx) {
|
|
447
|
-
if (this.noTty || !this.rl)
|
|
448
|
-
|
|
451
|
+
if (this.noTty || !this.rl) {
|
|
452
|
+
if ('default' in question) {
|
|
453
|
+
return question.default;
|
|
454
|
+
}
|
|
455
|
+
return;
|
|
456
|
+
}
|
|
449
457
|
this.keypress.resume();
|
|
450
458
|
const options = this.sanitizeOptions(question);
|
|
451
459
|
let input = '';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "inquirerer",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"author": "Dan Lynch <pyramation@gmail.com>",
|
|
5
5
|
"description": "inquirerer",
|
|
6
6
|
"main": "index.js",
|
|
@@ -35,5 +35,5 @@
|
|
|
35
35
|
"minimist": "^1.2.8"
|
|
36
36
|
},
|
|
37
37
|
"keywords": [],
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "1c3d99966ab7179ed56377dfab40a4a7209dd641"
|
|
39
39
|
}
|
package/prompt.js
CHANGED
|
@@ -332,8 +332,12 @@ class Inquirerer {
|
|
|
332
332
|
});
|
|
333
333
|
}
|
|
334
334
|
async text(question, ctx) {
|
|
335
|
-
if (this.noTty || !this.rl)
|
|
336
|
-
|
|
335
|
+
if (this.noTty || !this.rl) {
|
|
336
|
+
if ('default' in question) {
|
|
337
|
+
return question.default;
|
|
338
|
+
}
|
|
339
|
+
return;
|
|
340
|
+
}
|
|
337
341
|
let input = '';
|
|
338
342
|
return new Promise((resolve) => {
|
|
339
343
|
this.clearScreen();
|
|
@@ -450,8 +454,12 @@ class Inquirerer {
|
|
|
450
454
|
});
|
|
451
455
|
}
|
|
452
456
|
async autocomplete(question, ctx) {
|
|
453
|
-
if (this.noTty || !this.rl)
|
|
454
|
-
|
|
457
|
+
if (this.noTty || !this.rl) {
|
|
458
|
+
if ('default' in question) {
|
|
459
|
+
return question.default;
|
|
460
|
+
}
|
|
461
|
+
return;
|
|
462
|
+
}
|
|
455
463
|
this.keypress.resume();
|
|
456
464
|
const options = this.sanitizeOptions(question);
|
|
457
465
|
let input = '';
|