Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Node.js: How to increase readline/inquirer prompt height

I'm using inquirer.js for creating a yeoman-generator and when it comes to a long list as prompt the height of it is too short to show all items. How can I increase it?. I know inquirer.js uses an extended version of node.js's readline, I don't know if the limitation is on this module.

Pic related:

enter image description here

like image 669
R01010010 Avatar asked Sep 08 '15 07:09

R01010010


2 Answers

You can use pageSize to set num of items on page, more info

like image 126
Evgeniy Avatar answered Nov 03 '22 09:11

Evgeniy


@Evgenly answer points to the correct option but I didn't find the github link particularly useful.

The pageSize attribute allow to control the number of items to display:

inquirer
  .prompt([
    {
      type: 'rawlist',
      pageSize: 12,
      name: 'event',
      message: 'question?',
      choices: [
        'option1',
        'option2',
        'option3',
        'option4',
        'option5',
        'option6',
        'option7',
        'option8',
        'option9',
        'option10',
        'option11',
        'exit',
      ]
    },
  ])

This will output the whole 12 options in the terminal.

like image 34
Sergeon Avatar answered Nov 03 '22 08:11

Sergeon