标签:hat mil div 命令 简介 message family class 交互
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"
}
标签:hat mil div 命令 简介 message family class 交互
原文地址:https://www.cnblogs.com/mengfangui/p/12313440.html