[英]Node.js: Custom command line interface
您需要在package.json中指定myapp,如下所示:
{ "name": "myapp"
, "version": "0.0.1"
, "engines": [ "node >=0.4.0" ]
, "description": "myapp command line util."
, "author": "..."
, "contributors": []
, "keywords" : [ "myapp", "command", "shell" ]
, "repository":
{ "type" : "git"
, "url" : "https://...."
}
, "bin" : { "myapp" : "./bin/myapp.js" }
}
您可以使用npm中的commander模块来构建自己的CLI。 只需输入:
npm install commander
这将安装指挥官模块。
有关示例和文档,您可以阅读以下内容: https : //www.npmjs.com/package/commander
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.