您当前的位置: 首页 >  ui

彭世瑜

暂无认证

  • 3浏览

    0关注

    2791博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

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

彭世瑜 发布时间:2022-07-28 15:03:15 ,浏览量:3

在这里插入图片描述 A collection of common interactive command line user interfaces.

文档:

  • https://www.npmjs.com/package/inquirer
  • https://github.com/SBoudrias/Inquirer.js

安装

npm i inquirer

代码示例

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' }
})();

关注
打赏
1665367115
查看更多评论
立即登录/注册

微信扫码登录

0.0882s