使用 (Usage)

image

const prompts = require('prompts');

(async () => {
  const response = await prompts({
    type: 'number',
    name: 'value',
    message: 'How old are you?',
    validate: value => value < 18 ? `Nightclub is 18+ only` : true
  });

  console.log(response); // => { value: 24 }
})();
1
2
3
4
5
6
7
8
9
10
11
12

参见 example.js 查看更多示例

上次更新: 12/14/2019, 7:05:46 PM