node.js:Inquirer.js接收命令行交互输入_前端


A collection of common interactive command line user interfaces.

文档:

安装

npm

代码示例

import inquirer from "inquirer";

(async () => {
let input = await inquirer.prompt([
{
type: "list",
name: "type",
choices: ["money", "working", "exit"],
message: "please choose doing",
suffix: ":",
},
]);

console.log(input);
// { type: 'working' }
})();