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" }
原文地址:https://www.cnblogs.com/mengfangui/p/12313440.html
时间: 2024-11-05 15:57:06