Inquirer 交互式命令行
1.简介
常见的交互式命令行用户界面的集合。
https://www.npmjs.com/package/inquirer
2、示例(输入和单选)
var inquirer = require(‘inquirer‘); var questions = [ { type: ‘input‘, name: ‘name‘, message: "What‘s your name" }, { type: ‘list‘, name: ‘size‘, message: ‘What size do you need?‘, choices: [‘Jumbo‘, ‘Large‘, ‘Standard‘, ‘Medium‘, ‘Small‘, ‘Micro‘] } ]; inquirer.prompt(questions).then(answers => { console.log(JSON.stringify(answers, null, ‘ ‘)); });
输出:
{ "name": "meng", "size": "Large" }
相关推荐
吹云 2020-11-05
84407805 2020-11-01
曾是土木人 2020-10-31
87201442 2020-10-15
java0 2020-09-29
81437716 2020-09-18
81437716 2020-09-13
bluecarrot 2020-09-11
myCat 2020-09-09
83427718 2020-09-07
85560694 2020-09-03
89520991 2020-08-21
89550191 2020-08-09
katie000 2020-08-04
hunningtu 2020-07-30
89961330 2020-07-28
yuzhongdelei0 2020-07-28
yuzhongdelei0 2020-07-27