search

Home  >  Q&A  >  body text

node.js - 写一个nodejs的命令行工具,提供各种选项,通过上下移动后回车来选择,具体如图

如图这样,空格勾选,上下移动光标,回车确定

想知道怎么实现的

大家讲道理大家讲道理2767 days ago936

reply all(1)I'll reply

  • PHP中文网

    PHP中文网2017-04-17 14:49:08

    It’s troublesome to implement one by yourself. Fortunately, there are enough “giants’ shoulders” in the open source world to step on for us.

    You can refer to other node open source libraries. For example, grunt and yo provide functions like 问答 in the project initialization function.

    Let’s see how they achieve it?

    • grunt: implemented through the prompt library, click the portal

    • yo: Implemented through the Inquirer.js library, click on the portal

    Attached is a screenshot of the yoinitialization project

    reply
    0
  • Cancelreply