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

Using transformer and moving the caret cursor

Open gentunian opened this issue 6 years ago • 9 comments

Hi there :)

I'm using the transformer function to visually append hinted data such as:

transformer: (input, answer) => {
  return `${a}.mydomain.com`;
}

works as expected, but how could I play with the caret cursor so it's positioned where the user is typing:

out

Full example:

var inquirer = require('inquirer');

inquirer.prompt({
  name: 'hostname',
  type: 'input',
  message: 'hostname:',
  transformer: function(a,b) {
    return `${a}.mydomain.com`
  }
});

Is it possible?

gentunian avatar May 02 '18 18:05 gentunian