Node.js:需要帮助来创build命令行界面
我正在开发与node.js的命令行界面。 我们可以有像MySQL的自定义控制台? 就像,如果我们键入mysql并在控制台中input,它将作为mysql>
所以我们可以做所有mysql相关的操作,直到我们退出。 就像在node.js中一样
> node hello hello> help hello> list apps . . hello> exit > >node world world>operation related to world . . world>exit > // or if it is executable >hello hello>help hello>list app hello>exit >
如果你提出一些build议,这将是很好的。
是。 看看Vorpal.js 。 这是为了这个确切的目的。
var vorpal = require('vorpal')(); ... // your app code vorpal.command('list apps') .action(function (args, cb){ var self = this; myapps.forEach(function(app) { self.log(app.name); }); cb(); }); vorpal .delimiter('hello>') .show();
然后你会有这个:
$ node hello.js hello> list apps .. .. hello>
免责声明:我写了Vorpal。
- 运行命令后npm install -g @angular \ cli我收到一个npm ERR! 代码ENOLOCAL
- JavaScript – 使用JasminetestingNodeJS readline.createInterface的实现
- NodeJS应用程序作为CLI工具
- 如何将STDIN传递给node.jssubprocess
- 使用npm / nodejs命令行实用程序坚持用户首选项的最佳方法
- 如何将ProcessBar修复到Nodejs CLI的首行?
- 有没有一个模块获取用户input从node.js命令行?
- 在没有“脚本”条目的情况下实现“npm run x”行为?
- CLI的commander.js集成testing