Inquirer.js icon indicating copy to clipboard operation
Inquirer.js copied to clipboard

Edit or disable List prompt suffix text (Use arrow keys)

Open redpwilliams opened this issue 3 years ago • 1 comments

Example

image

Feature Request

It would be nice if I can edit that, much like the prefix and suffix arguments for the Question object, or remove it all together. Is this already possible?

redpwilliams avatar May 27 '21 21:05 redpwilliams

I looked at more of the codebase, and I found where the change would go. I am not making a PR yet because I don't know if this is intended behavior based on how this is written:

In Inquirer.js\packages\inquirer\lib\prompts\list.js:

if (this.firstRender) {
      message += chalk.dim('(Use arrow keys)');
}

I understand that suffix is already appended to message in the Super base.js: (for reference)

getQuestion() {
    let message =
      this.opt.prefix +
      ' ' +
      chalk.bold(this.opt.message) +
      this.opt.suffix +
      chalk.reset(' ');
. . .

If this is intended behavior, an easy fix might be adding an option to enable, disable, or set that string ("Use arrow keys"). A larger fix might be leaving the prefix/suffix concatenation for the subclasses for more specific use, and just passing message as is.

What do you think?

redpwilliams avatar May 27 '21 22:05 redpwilliams