node.jsinquirerjs

Inquirer.js, change symbol at the beginning of question?


By default inquirer js questions are preceded by a '?'. Is it possible to change it to something else? I tried exploring but did not find it mentioned anywhere.


Solution

  • Sure, you can change the prefix of your question with the prefix option of your question object:

    inquirer
      .prompt({
        type: 'input',
        prefix: '$',
        name: 'first_name',
        message: 'What\'s your first name'
      })
    
      // => $ What's your first name