一个好用的命令行交互工具:ipt

Interactive Pipe To: The Node.js cli interactive workflow.
更新于: 2022-06-10 07:49:21

安装

npm i ipt

使用

const ipt = require("ipt");
const opts = {
  stdin: process.stdin,
  stdout: process.stdout,
  message: "Select an item?",
  autocomplete: false,
  size: 3,
};

ipt(["option1", "option2", "option3", "option4", "option5"], opts).then((res) => {
  console.log("res:", res[0]);
});
ipt使用范例

参考