Prompts

prompts

Lightweight, beautiful and user-friendly interactive CLI prompts

prompts Zero dep, promise based, unifined CLI prompt.

Get it: npm install prompts

Sample usage:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
const prompts = require('prompts');

let questions = [
    {
        type: 'text',
        name: 'dish',
        message: 'Do you like pizza?'
    },
    {
        type: prev => prev == 'pizza' ? 'text' : null,
        name: 'topping',
        message: 'Name a topping'
    }
];

let response = await prompts(questions);

API:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
prompts(prompts, options);

/*
prompts:
Type: Array|Object

options: onSubmit or onCancel functions.

prompt object properties:

{
  type: String || Function,
  name: String || Function,
  message: String || Function,
  initial: String || Function || Async Function
  format: Function || Async Function,
  onState: Function
}
*/

GIT FTW!

prompts.gif

Suggest a module

Comments