inquirerer 1.2.0 → 1.4.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 CHANGED
@@ -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: !this.argv.tty ? true : this.options.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
@@ -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: !this.argv.tty ? true : this.options.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
- return question.default ?? null; // Return default if non-interactive
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
- return question.default ?? false; // Return default if non-interactive
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.2.0",
3
+ "version": "1.4.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": "fd80e2379caacef95200bef7b7f4778b8263355c"
38
+ "gitHead": "b782a9a8f201cdc779f7425774f680bc758a2506"
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
- return question.default ?? null; // Return default if non-interactive
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
- return question.default ?? false; // Return default if non-interactive
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 = '';