TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

How to write a command line application in Node.js

76 点作者 dpmehta02将近 12 年前

11 条评论

jasondenizac将近 12 年前
The number one reason to write CLI apps in node is npm. npm gets package management right, preferring local dependencies to global ones - this means no worrying about what version of a library a user has in their global environment.<p>You also get to bring node&#x27;s parallel io-centric patterns to your scripting. Need to download a bunch of files from a remote host, process them, and write them to disk? Go for it.<p>But take it with a grain of salt: it&#x27;s very much a use-what-you-know kind of thing.
评论 #6190268 未加载
评论 #6189381 未加载
评论 #6189611 未加载
qrohlf将近 12 年前
Is there a reason to build a command line application in Node.js? It doesn&#x27;t really seem like Node is the right tool for the job...
评论 #6189156 未加载
评论 #6189160 未加载
评论 #6189179 未加载
评论 #6189327 未加载
评论 #6190521 未加载
评论 #6189566 未加载
评论 #6190064 未加载
meandave将近 12 年前
This was also recently released. <a href="https://github.com/chjj/blessed" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;chjj&#x2F;blessed</a>
clarle将近 12 年前
Definitely check out Inquirer.js if you&#x27;re using prompts in a Node CLI application. It&#x27;s the prompt utility used by Yeoman generators:<p><a href="https://github.com/SBoudrias/Inquirer.js" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;SBoudrias&#x2F;Inquirer.js</a>
olegp将近 12 年前
Callbacks and CLI apps aren&#x27;t a good fit in my opinion. I do like writing command line tools using Common Node though: <a href="https://github.com/olegp/common-node" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;olegp&#x2F;common-node</a>
logn将近 12 年前
Or you could just use <a href="http://silkjs.net" rel="nofollow">http:&#x2F;&#x2F;silkjs.net</a>
petercooper将近 12 年前
Something similar but published just last week: <a href="http://flippinawesome.org/2013/07/29/writing-a-command-line-utility-using-node/" rel="nofollow">http:&#x2F;&#x2F;flippinawesome.org&#x2F;2013&#x2F;07&#x2F;29&#x2F;writing-a-command-line-...</a>
rtsuk将近 12 年前
I find the lack of a synchronous way to pass a command to the shell and get the result makes node much more difficult for the kinds of things I usual write in ruby.
oscargrouch将近 12 年前
in this day and age, if i had to create a command line app, from zero, i would definetly start with go.. it has all the functionality in standard libs and the package manager can handle github repos for third-parties (like mongo or mysql drivers).. you just compile it and go!<p>can be as simple than that? the right tool for the job..<p>if i would create a library that everyone could use and embed i would use C for that..<p>if i would like to build a VM, a compiler, a browser or a OS i would use c++ (is almost c, fast and gives you easy composability and control)<p>i would use javascript.. but only in the browser and because and dont have nowhere to go or to runaway for.. (no transpiling either please)<p>this is just the general experience of my years of coding and deling with every lang in the earth.. rsrs<p>ruby is pretty, eyecandy, bu is like a virgen that cant be touched.. python looks just like perl.. is a complete mess, and is like the mafia,i prefer not to touch or to have any involvement with them.. java is the frankenstein child of c++.. you can create big software with it.. but to many keywords and excessive use of vtables..<p>and for ui and web, network, etc.. i would use something like dart for this job, any day.. the code can grow and you can still understand your code<p>so these days i would use c, c++, go or dart.. in the case i can choose of course.. :)
评论 #6190173 未加载
评论 #6190195 未加载
vehementi将近 12 年前
Bunch of broken URLs due to closing parentheses
dpweb将近 12 年前
github.com&#x2F;dpweb&#x2F;cli-node