简体   繁体   English

如何创建在Linux终端中运行的Javascript应用程序?

[英]How can I create a Javascript application to run in the Linux terminal?

I want to create a Javascript (using Electron) app, but I want this app to be run and executed with terminal commands, like how you run git , is there a way to accomplish this? 我想创建一个Javascript(使用Electron)应用程序,但是我希望通过终端命令(例如,如何运行git运行和执行该应用程序,有没有办法做到这一点?

I know that python and ruby are better languages for this purpose but I have a reason to use electron. 我知道python和ruby是用于此目的的更好的语言,但是我有使用电子的理由。

For non-GUI applications, you can just use node.js directly. 对于非GUI应用程序,您可以直接使用node.js。 If you want to make a TUI, you can use node.js + a module like blessed (and possibly blessed-contrib ). 如果要制作TUI,则可以使用node.js +一个模块,例如blessed (可能还有blessed-contrib )。

Electron is basically Chromium browser with tabs and all that stuff stripped out, plus a pile of tools to work with the user's desktop environment added in. It lets you use add HTML and CSS to a Node.JS application to create a GUI. Electron基本上是Chromium浏览器,带有选项卡,所有内容都去除了,再加上一堆工具来与用户的桌面环境一起使用。它使您可以使用将HTML和CSS添加到Node.JS应用程序来创建GUI。

If all you need is a terminal command, Electron is completely unnecessary. 如果您只需要一个终端命令,则完全不需要Electron。

Here's a little pile of links to help you get started creating your command line app: 这里有一些链接,可帮助您开始创建命令行应用程序:

带有Commander npm模块的Node.js可以很好地满足您的需求。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM