inquirerer 1.4.0 → 1.6.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
@@ -48,7 +48,7 @@ class CLI {
48
48
  process.exit(0);
49
49
  }
50
50
  const args = await this.commandHandler(this.argv, this.prompter, this.options);
51
- this.prompter.close();
51
+ this.prompter.exit();
52
52
  return args;
53
53
  }
54
54
  }
package/esm/commander.js CHANGED
@@ -42,7 +42,7 @@ export class CLI {
42
42
  process.exit(0);
43
43
  }
44
44
  const args = await this.commandHandler(this.argv, this.prompter, this.options);
45
- this.prompter.close();
45
+ this.prompter.exit();
46
46
  return args;
47
47
  }
48
48
  }
package/esm/keypress.js CHANGED
@@ -9,7 +9,7 @@ export const KEY_CODES = {
9
9
  ENTER: '\r',
10
10
  SPACE: ' ',
11
11
  CTRL_C: '\u0003',
12
- BACKSPACE: '\x7f',
12
+ BACKSPACE: '\x7f', // Commonly used BACKSPACE key in Unix-like systems
13
13
  BACKSPACE_LEGACY: '\x08' // For compatibility with some systems
14
14
  };
15
15
  export class TerminalKeypress {
package/esm/prompt.js CHANGED
@@ -16,7 +16,6 @@ const validationMessage = (question, ctx) => {
16
16
  default:
17
17
  return chalk.red(`The field "${question.name}" is invalid. Please try again.\n`);
18
18
  }
19
- return ''; // Return empty string if no specific conditions are met
20
19
  };
21
20
  class PromptContext {
22
21
  numTries = 0;
@@ -89,11 +88,13 @@ export class Inquirerer {
89
88
  input;
90
89
  useDefaults;
91
90
  globalMaxLines;
91
+ mutateArgs;
92
92
  constructor(options) {
93
- const { noTty = false, input = process.stdin, output = process.stdout, useDefaults = false, globalMaxLines = 10 } = options ?? {};
93
+ const { noTty = false, input = process.stdin, output = process.stdout, useDefaults = false, globalMaxLines = 10, mutateArgs = true } = options ?? {};
94
94
  this.useDefaults = useDefaults;
95
95
  this.noTty = noTty;
96
96
  this.output = output;
97
+ this.mutateArgs = mutateArgs;
97
98
  this.input = input;
98
99
  this.globalMaxLines = globalMaxLines;
99
100
  if (!noTty) {
@@ -135,48 +136,48 @@ export class Inquirerer {
135
136
  this.log(prompt);
136
137
  }
137
138
  generateManPage(opts) {
138
- let manPage = `NAME\n\t${opts.commandName} ${opts.description ?? ''}\n\n`;
139
+ let manPage = `${chalk.white('NAME')}\n\t${chalk.white(opts.commandName)} ${opts.description ?? ''}\n\n`;
139
140
  // Constructing the SYNOPSIS section with required and optional arguments
140
141
  let requiredArgs = '';
141
142
  let optionalArgs = '';
142
143
  opts.questions.forEach(question => {
143
144
  if (question.required) {
144
- requiredArgs += ` --${question.name} <${question.name}>`;
145
+ requiredArgs += ` ${chalk.white('--' + question.name)} <${chalk.gray(question.name)}>`;
145
146
  }
146
147
  else {
147
- optionalArgs += ` [--${question.name}${question.default ? `=${question.default}` : ''}]`;
148
+ optionalArgs += ` [${chalk.white('--' + question.name)}${question.default ? `=${chalk.gray(String(question.default))}` : ''}]`;
148
149
  }
149
150
  });
150
- manPage += `SYNOPSIS\n\t${opts.commandName}${requiredArgs}${optionalArgs}\n\n`;
151
- manPage += `DESCRIPTION\n\tUse this command to interact with the application. It supports the following options:\n\n`;
151
+ manPage += `${chalk.white('SYNOPSIS')}\n\t${chalk.white(opts.commandName)}${chalk.gray(requiredArgs)}${chalk.gray(optionalArgs)}\n\n`;
152
+ manPage += `${chalk.white('DESCRIPTION')}\n\tUse this command to interact with the application. It supports the following options:\n\n`;
152
153
  opts.questions.forEach(question => {
153
- manPage += `${question.name.toUpperCase()}\n`;
154
- manPage += `\tType: ${question.type}\n`;
154
+ manPage += `${chalk.white(question.name.toUpperCase())}\n`;
155
+ manPage += `\t${chalk.white('Type:')} ${chalk.gray(question.type)}\n`;
155
156
  if (question.message) {
156
- manPage += `\tSummary: ${question.message}\n`;
157
+ manPage += `\t${chalk.white('Summary:')} ${chalk.gray(question.message)}\n`;
157
158
  }
158
159
  if (question.description) {
159
- manPage += `\tDescription: ${question.description}\n`;
160
+ manPage += `\t${chalk.white('Description:')} ${chalk.gray(question.description)}\n`;
160
161
  }
161
162
  if ('options' in question) {
162
163
  const optionsList = Array.isArray(question.options)
163
- ? question.options.map(opt => typeof opt === 'string' ? opt : `${opt.name} (${opt.value})`).join(', ')
164
+ ? question.options.map(opt => typeof opt === 'string' ? chalk.gray(opt) : `${chalk.gray(opt.name)} (${chalk.gray(opt.value)})`).join(', ')
164
165
  : '';
165
- manPage += `\tOptions: ${optionsList}\n`;
166
+ manPage += `\t${chalk.white('Options:')} ${chalk.gray(optionsList)}\n`;
166
167
  }
167
168
  if (question.default !== undefined) {
168
- manPage += `\tDefault: ${JSON.stringify(question.default)}\n`;
169
+ manPage += `\t${chalk.white('Default:')} ${chalk.gray(JSON.stringify(question.default))}\n`;
169
170
  }
170
171
  if (question.required) {
171
- manPage += `\tRequired: Yes\n`;
172
+ manPage += `\t${chalk.white('Required:')} ${chalk.gray('Yes')}\n`;
172
173
  }
173
174
  else {
174
- manPage += `\tRequired: No\n`;
175
+ manPage += `\t${chalk.white('Required:')} ${chalk.gray('No')}\n`;
175
176
  }
176
177
  manPage += '\n';
177
178
  });
178
- manPage += `EXAMPLES\n\tExample usage of \`${opts.commandName}\`.\n\t$ ${opts.commandName}${requiredArgs}${optionalArgs}\n\n`;
179
- manPage += opts.author ? `AUTHOR\n\t${opts.author}\n` : '';
179
+ manPage += `${chalk.white('EXAMPLES')}\n\tExample usage of \`${chalk.white(opts.commandName)}\`.\n\t$ ${chalk.white(opts.commandName)}${chalk.gray(requiredArgs)}${chalk.gray(optionalArgs)}\n\n`;
180
+ manPage += opts.author ? `${chalk.white('AUTHOR')}\n\t${chalk.white(opts.author)}\n` : '';
180
181
  return manPage;
181
182
  }
182
183
  isValidatableAnswer(answer) {
@@ -246,8 +247,12 @@ export class Inquirerer {
246
247
  }
247
248
  return answer;
248
249
  }
249
- async prompt(argv, questions, docs) {
250
- const obj = { ...argv };
250
+ exit() {
251
+ this.clearScreen();
252
+ this.close();
253
+ }
254
+ async prompt(argv, questions, options) {
255
+ let obj = (this.mutateArgs || options.mutateArgs) ? argv : { ...argv };
251
256
  // Assuming questions is an array of Question objects and argv is the parsed command line arguments object.
252
257
  // @ts-ignore
253
258
  if (this.noTty && questions.some(question => question.required && this.isEmptyAnswer(argv[question.name]))) {
@@ -263,16 +268,17 @@ export class Inquirerer {
263
268
  return obj;
264
269
  }
265
270
  // If running in a non-interactive mode and any required argument is missing, handle the error.
266
- if (docs?.usageText) {
267
- this.log(docs.usageText);
271
+ this.clearScreen();
272
+ if (options?.usageText) {
273
+ this.log(options.usageText);
268
274
  }
269
- else if (docs?.manPageInfo) {
270
- this.log(this.generateManPage(docs.manPageInfo));
275
+ else if (options?.manPageInfo) {
276
+ this.log(this.generateManPage(options.manPageInfo));
271
277
  }
272
278
  else {
273
279
  this.log('Missing required arguments. Please provide all required parameters.');
274
280
  }
275
- process.exit(1);
281
+ throw new Error('Missing required arguments. Please provide all required parameters.');
276
282
  }
277
283
  for (let index = 0; index < questions.length; index++) {
278
284
  const question = questions[index];
@@ -285,6 +291,11 @@ export class Inquirerer {
285
291
  while (ctx.needsInput) {
286
292
  obj[question.name] = await this.handleQuestionType(question, ctx);
287
293
  if (!this.isValid(question, obj, ctx)) {
294
+ if (this.noTty) {
295
+ // If you're not valid and here with noTty, you're out!
296
+ this.clearScreen(); // clear before leaving, not calling exit() since it may be a bad pattern to continue, devs should try/catch
297
+ throw new Error('Missing required arguments. Please provide all required parameters.');
298
+ }
288
299
  continue;
289
300
  }
290
301
  // If input passes validation and is not empty, or not required, move to the next question
@@ -349,6 +360,10 @@ export class Inquirerer {
349
360
  async checkbox(question, ctx) {
350
361
  if (this.noTty || !this.rl)
351
362
  return question.default ?? []; // Return default if non-interactive
363
+ if (!question.options.length) {
364
+ // no arguments don't make sense
365
+ throw new Error('checkbox requires options');
366
+ }
352
367
  this.keypress.resume();
353
368
  const options = this.sanitizeOptions(question);
354
369
  let input = ''; // Search input
@@ -454,6 +469,9 @@ export class Inquirerer {
454
469
  }
455
470
  return;
456
471
  }
472
+ if (!question.options.length) {
473
+ throw new Error('autocomplete requires options');
474
+ }
457
475
  this.keypress.resume();
458
476
  const options = this.sanitizeOptions(question);
459
477
  let input = '';
@@ -554,6 +572,8 @@ export class Inquirerer {
554
572
  input = input.toLowerCase(); // Normalize input for case-insensitive comparison
555
573
  // Fuzzy matching: Check if all characters of the input can be found in the option name in order
556
574
  const fuzzyMatch = (option, input) => {
575
+ if (!input || !input.trim().length)
576
+ return true;
557
577
  const length = input.length;
558
578
  let position = 0; // Position in the input string
559
579
  // Iterate over each character in the option name
@@ -590,6 +610,7 @@ export class Inquirerer {
590
610
  return Math.min(this.globalMaxLines, defaultLength);
591
611
  }
592
612
  // Method to cleanly close the readline interface
613
+ // NOTE: use exit() to close!
593
614
  close() {
594
615
  if (this.rl) {
595
616
  this.rl.close();
package/keypress.js CHANGED
@@ -12,7 +12,7 @@ exports.KEY_CODES = {
12
12
  ENTER: '\r',
13
13
  SPACE: ' ',
14
14
  CTRL_C: '\u0003',
15
- BACKSPACE: '\x7f',
15
+ BACKSPACE: '\x7f', // Commonly used BACKSPACE key in Unix-like systems
16
16
  BACKSPACE_LEGACY: '\x08' // For compatibility with some systems
17
17
  };
18
18
  class TerminalKeypress {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "inquirerer",
3
- "version": "1.4.0",
3
+ "version": "1.6.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": "b782a9a8f201cdc779f7425774f680bc758a2506"
38
+ "gitHead": "7c0bfaacaac54980e2a1a1c918fd069e9260437f"
39
39
  }
package/prompt.d.ts CHANGED
@@ -1,12 +1,17 @@
1
1
  /// <reference types="node" />
2
2
  import { Readable, Writable } from 'stream';
3
3
  import { AutocompleteQuestion, CheckboxQuestion, ConfirmQuestion, OptionValue, Question, TextQuestion, Validation } from './question';
4
- interface ManPageInfo {
4
+ export interface ManPageInfo {
5
5
  commandName: string;
6
6
  questions: Question[];
7
7
  author?: string;
8
8
  description?: string;
9
9
  }
10
+ export interface PromptOptions {
11
+ usageText?: string;
12
+ manPageInfo?: ManPageInfo;
13
+ mutateArgs?: boolean;
14
+ }
10
15
  declare class PromptContext {
11
16
  numTries: number;
12
17
  needsInput: boolean;
@@ -22,6 +27,7 @@ export interface InquirererOptions {
22
27
  output?: Writable;
23
28
  useDefaults?: boolean;
24
29
  globalMaxLines?: number;
30
+ mutateArgs?: boolean;
25
31
  }
26
32
  export declare class Inquirerer {
27
33
  private rl;
@@ -31,13 +37,14 @@ export declare class Inquirerer {
31
37
  private input;
32
38
  private useDefaults;
33
39
  private globalMaxLines;
40
+ private mutateArgs;
34
41
  constructor(options?: InquirererOptions);
35
- clearScreen(): void;
36
- write(message: string): void;
37
- log(message: string): void;
38
- getInput(input: string): string;
39
- getPrompt(question: Question, ctx: PromptContext, input: string): string;
40
- displayPrompt(question: Question, ctx: PromptContext, input: string): void;
42
+ private clearScreen;
43
+ private write;
44
+ private log;
45
+ private getInput;
46
+ private getPrompt;
47
+ private displayPrompt;
41
48
  generateManPage(opts: ManPageInfo): string;
42
49
  private isValidatableAnswer;
43
50
  private validateAnswer;
@@ -45,10 +52,8 @@ export declare class Inquirerer {
45
52
  private validateAnswerPattern;
46
53
  private isEmptyAnswer;
47
54
  private sanitizeAnswer;
48
- prompt<T extends object>(argv: T, questions: Question[], docs?: {
49
- usageText?: string;
50
- manPageInfo?: ManPageInfo;
51
- }): Promise<T>;
55
+ exit(): void;
56
+ prompt<T extends object>(argv: T, questions: Question[], options?: PromptOptions): Promise<T>;
52
57
  private handleQuestionType;
53
58
  confirm(question: ConfirmQuestion, ctx: PromptContext): Promise<boolean>;
54
59
  text(question: TextQuestion, ctx: PromptContext): Promise<string | null>;
@@ -56,10 +61,8 @@ export declare class Inquirerer {
56
61
  autocomplete(question: AutocompleteQuestion, ctx: PromptContext): Promise<any>;
57
62
  private getOptionValue;
58
63
  private sanitizeOptions;
59
- filterOptions(options: OptionValue[], input: string): OptionValue[];
60
- getMaxLines(question: {
61
- maxDisplayLines?: number;
62
- }, defaultLength: number): number;
63
- close(): void;
64
+ private filterOptions;
65
+ private getMaxLines;
66
+ private close;
64
67
  }
65
68
  export {};
package/prompt.js CHANGED
@@ -22,7 +22,6 @@ const validationMessage = (question, ctx) => {
22
22
  default:
23
23
  return chalk_1.default.red(`The field "${question.name}" is invalid. Please try again.\n`);
24
24
  }
25
- return ''; // Return empty string if no specific conditions are met
26
25
  };
27
26
  class PromptContext {
28
27
  numTries = 0;
@@ -95,11 +94,13 @@ class Inquirerer {
95
94
  input;
96
95
  useDefaults;
97
96
  globalMaxLines;
97
+ mutateArgs;
98
98
  constructor(options) {
99
- const { noTty = false, input = process.stdin, output = process.stdout, useDefaults = false, globalMaxLines = 10 } = options ?? {};
99
+ const { noTty = false, input = process.stdin, output = process.stdout, useDefaults = false, globalMaxLines = 10, mutateArgs = true } = options ?? {};
100
100
  this.useDefaults = useDefaults;
101
101
  this.noTty = noTty;
102
102
  this.output = output;
103
+ this.mutateArgs = mutateArgs;
103
104
  this.input = input;
104
105
  this.globalMaxLines = globalMaxLines;
105
106
  if (!noTty) {
@@ -141,48 +142,48 @@ class Inquirerer {
141
142
  this.log(prompt);
142
143
  }
143
144
  generateManPage(opts) {
144
- let manPage = `NAME\n\t${opts.commandName} ${opts.description ?? ''}\n\n`;
145
+ let manPage = `${chalk_1.default.white('NAME')}\n\t${chalk_1.default.white(opts.commandName)} ${opts.description ?? ''}\n\n`;
145
146
  // Constructing the SYNOPSIS section with required and optional arguments
146
147
  let requiredArgs = '';
147
148
  let optionalArgs = '';
148
149
  opts.questions.forEach(question => {
149
150
  if (question.required) {
150
- requiredArgs += ` --${question.name} <${question.name}>`;
151
+ requiredArgs += ` ${chalk_1.default.white('--' + question.name)} <${chalk_1.default.gray(question.name)}>`;
151
152
  }
152
153
  else {
153
- optionalArgs += ` [--${question.name}${question.default ? `=${question.default}` : ''}]`;
154
+ optionalArgs += ` [${chalk_1.default.white('--' + question.name)}${question.default ? `=${chalk_1.default.gray(String(question.default))}` : ''}]`;
154
155
  }
155
156
  });
156
- manPage += `SYNOPSIS\n\t${opts.commandName}${requiredArgs}${optionalArgs}\n\n`;
157
- manPage += `DESCRIPTION\n\tUse this command to interact with the application. It supports the following options:\n\n`;
157
+ manPage += `${chalk_1.default.white('SYNOPSIS')}\n\t${chalk_1.default.white(opts.commandName)}${chalk_1.default.gray(requiredArgs)}${chalk_1.default.gray(optionalArgs)}\n\n`;
158
+ manPage += `${chalk_1.default.white('DESCRIPTION')}\n\tUse this command to interact with the application. It supports the following options:\n\n`;
158
159
  opts.questions.forEach(question => {
159
- manPage += `${question.name.toUpperCase()}\n`;
160
- manPage += `\tType: ${question.type}\n`;
160
+ manPage += `${chalk_1.default.white(question.name.toUpperCase())}\n`;
161
+ manPage += `\t${chalk_1.default.white('Type:')} ${chalk_1.default.gray(question.type)}\n`;
161
162
  if (question.message) {
162
- manPage += `\tSummary: ${question.message}\n`;
163
+ manPage += `\t${chalk_1.default.white('Summary:')} ${chalk_1.default.gray(question.message)}\n`;
163
164
  }
164
165
  if (question.description) {
165
- manPage += `\tDescription: ${question.description}\n`;
166
+ manPage += `\t${chalk_1.default.white('Description:')} ${chalk_1.default.gray(question.description)}\n`;
166
167
  }
167
168
  if ('options' in question) {
168
169
  const optionsList = Array.isArray(question.options)
169
- ? question.options.map(opt => typeof opt === 'string' ? opt : `${opt.name} (${opt.value})`).join(', ')
170
+ ? question.options.map(opt => typeof opt === 'string' ? chalk_1.default.gray(opt) : `${chalk_1.default.gray(opt.name)} (${chalk_1.default.gray(opt.value)})`).join(', ')
170
171
  : '';
171
- manPage += `\tOptions: ${optionsList}\n`;
172
+ manPage += `\t${chalk_1.default.white('Options:')} ${chalk_1.default.gray(optionsList)}\n`;
172
173
  }
173
174
  if (question.default !== undefined) {
174
- manPage += `\tDefault: ${JSON.stringify(question.default)}\n`;
175
+ manPage += `\t${chalk_1.default.white('Default:')} ${chalk_1.default.gray(JSON.stringify(question.default))}\n`;
175
176
  }
176
177
  if (question.required) {
177
- manPage += `\tRequired: Yes\n`;
178
+ manPage += `\t${chalk_1.default.white('Required:')} ${chalk_1.default.gray('Yes')}\n`;
178
179
  }
179
180
  else {
180
- manPage += `\tRequired: No\n`;
181
+ manPage += `\t${chalk_1.default.white('Required:')} ${chalk_1.default.gray('No')}\n`;
181
182
  }
182
183
  manPage += '\n';
183
184
  });
184
- manPage += `EXAMPLES\n\tExample usage of \`${opts.commandName}\`.\n\t$ ${opts.commandName}${requiredArgs}${optionalArgs}\n\n`;
185
- manPage += opts.author ? `AUTHOR\n\t${opts.author}\n` : '';
185
+ manPage += `${chalk_1.default.white('EXAMPLES')}\n\tExample usage of \`${chalk_1.default.white(opts.commandName)}\`.\n\t$ ${chalk_1.default.white(opts.commandName)}${chalk_1.default.gray(requiredArgs)}${chalk_1.default.gray(optionalArgs)}\n\n`;
186
+ manPage += opts.author ? `${chalk_1.default.white('AUTHOR')}\n\t${chalk_1.default.white(opts.author)}\n` : '';
186
187
  return manPage;
187
188
  }
188
189
  isValidatableAnswer(answer) {
@@ -252,8 +253,12 @@ class Inquirerer {
252
253
  }
253
254
  return answer;
254
255
  }
255
- async prompt(argv, questions, docs) {
256
- const obj = { ...argv };
256
+ exit() {
257
+ this.clearScreen();
258
+ this.close();
259
+ }
260
+ async prompt(argv, questions, options) {
261
+ let obj = (this.mutateArgs || options.mutateArgs) ? argv : { ...argv };
257
262
  // Assuming questions is an array of Question objects and argv is the parsed command line arguments object.
258
263
  // @ts-ignore
259
264
  if (this.noTty && questions.some(question => question.required && this.isEmptyAnswer(argv[question.name]))) {
@@ -269,16 +274,17 @@ class Inquirerer {
269
274
  return obj;
270
275
  }
271
276
  // If running in a non-interactive mode and any required argument is missing, handle the error.
272
- if (docs?.usageText) {
273
- this.log(docs.usageText);
277
+ this.clearScreen();
278
+ if (options?.usageText) {
279
+ this.log(options.usageText);
274
280
  }
275
- else if (docs?.manPageInfo) {
276
- this.log(this.generateManPage(docs.manPageInfo));
281
+ else if (options?.manPageInfo) {
282
+ this.log(this.generateManPage(options.manPageInfo));
277
283
  }
278
284
  else {
279
285
  this.log('Missing required arguments. Please provide all required parameters.');
280
286
  }
281
- process.exit(1);
287
+ throw new Error('Missing required arguments. Please provide all required parameters.');
282
288
  }
283
289
  for (let index = 0; index < questions.length; index++) {
284
290
  const question = questions[index];
@@ -291,6 +297,11 @@ class Inquirerer {
291
297
  while (ctx.needsInput) {
292
298
  obj[question.name] = await this.handleQuestionType(question, ctx);
293
299
  if (!this.isValid(question, obj, ctx)) {
300
+ if (this.noTty) {
301
+ // If you're not valid and here with noTty, you're out!
302
+ this.clearScreen(); // clear before leaving, not calling exit() since it may be a bad pattern to continue, devs should try/catch
303
+ throw new Error('Missing required arguments. Please provide all required parameters.');
304
+ }
294
305
  continue;
295
306
  }
296
307
  // If input passes validation and is not empty, or not required, move to the next question
@@ -355,6 +366,10 @@ class Inquirerer {
355
366
  async checkbox(question, ctx) {
356
367
  if (this.noTty || !this.rl)
357
368
  return question.default ?? []; // Return default if non-interactive
369
+ if (!question.options.length) {
370
+ // no arguments don't make sense
371
+ throw new Error('checkbox requires options');
372
+ }
358
373
  this.keypress.resume();
359
374
  const options = this.sanitizeOptions(question);
360
375
  let input = ''; // Search input
@@ -460,6 +475,9 @@ class Inquirerer {
460
475
  }
461
476
  return;
462
477
  }
478
+ if (!question.options.length) {
479
+ throw new Error('autocomplete requires options');
480
+ }
463
481
  this.keypress.resume();
464
482
  const options = this.sanitizeOptions(question);
465
483
  let input = '';
@@ -560,6 +578,8 @@ class Inquirerer {
560
578
  input = input.toLowerCase(); // Normalize input for case-insensitive comparison
561
579
  // Fuzzy matching: Check if all characters of the input can be found in the option name in order
562
580
  const fuzzyMatch = (option, input) => {
581
+ if (!input || !input.trim().length)
582
+ return true;
563
583
  const length = input.length;
564
584
  let position = 0; // Position in the input string
565
585
  // Iterate over each character in the option name
@@ -596,6 +616,7 @@ class Inquirerer {
596
616
  return Math.min(this.globalMaxLines, defaultLength);
597
617
  }
598
618
  // Method to cleanly close the readline interface
619
+ // NOTE: use exit() to close!
599
620
  close() {
600
621
  if (this.rl) {
601
622
  this.rl.close();