How do I open an Electron app from the command line? - command-line

Question
I want to open a installed electron app from the Command prompt. Similar to Visual Studio Code. Typing code opens VScode.
How to do something like that? I also want to provide custom arguments when opening from CLI. Example:-
printapp --option1=foo --option2
Then, in the app I would use those to perform different tasks. Is this possible? I want it to be cross-platform? It should not have .exe extensions. I want it to be like VScode. It should not be something like this:-
printapp.exe --options
Other References
Take a look at https://hyper.is. It also has a CLI to open the app and do tasks. I want something like hyper or VScode. Even atom has something similar like this.
Other possibilities
If opening a app from the command line is impossible in electron,
is there a way to bundle a CLI with a app using electron-builder (I would bundle a Node JS CLI with the app and when the user installs my app, they could use the GUI / CLI, without installing the CLI separately. Something like hyper I mentioned above)?
If possible, I would use the extra files option in electron-builder and move the CLI to the resources folder and set the PATH variable. But,
It may not be cross-platform
How to set the PATH variable when installing a app? (I don't know macros)
Any method to open the app from the CLI which is cross-platform is appreciated.

Related

VSCode - Automatically pick debugger

I have an Ansible workspace where I'm writing YML, PowerShell, and Python. Because of how things are set up where I work, I can't directly debug the YML files, so I need a custom launch configuration to run the files the way they are needed.
I'd love to just assign this to only YML extensions and leave the default debugger for Python and PowerShell files, as I switch between them quite often.
My current setup has a debug.ps1 file that will automatically switch between what it should launch based on the file that was debugged, but the Python files launch without the help of the Python debugger. I'd love for some way to either make that script launch the Python debugger, or make some sort of pre-debug task that tells VSCode what debugger to use.
Is there any way to do this?
Thanks!

Install VS Code extension during development?

I am developing an extension for VS Code. This extension is already good enough for me to use during daily work, but not good enough to be published (yet). Is there a canonical way to make an unpublished extension under development available to VS Code? Optimally, I would like to always have the current state of the code running.
I did find a way that seems to work, but I'm not sure whether this is a terrible hack or okay: Create a symbolic link in VS Code's extensions directory (~/.vscode/extensions on Linux) to the development directory. Is there a better/official way?
You can package your extension (even if it's in development) using vsce with the command vsce package. This will create a .vsix file which you can install in your regular instance of VSCode in the marketplace menu (click on the ... icon at the top and select "Install from .vsix file).
If you need to view the logs of the extension, go to Help>Toggle Developer tools and use the console to view your extension's output (if there is any).

Is it possible to open a C# solution in Rider via the command line?

It's possible with VS code via installing a shell command, as seen in this SO question: How to open Visual Studio Code from the command line on OSX?
Is the same thing possible with Jetbrain's Rider?
It is possible to open any file, folder, or solution and project in Rider for editing.
Here is a corresponding help page.
If you use a standalone Rider, you need to create a shell script. Call the action "Tools | Create Command-Line Launcher...". Then you will be able to call rider in a terminal as the shell script is by default created in /usr/local/bin.
In the case of using Toolbox installations, all scripts should be generated using Toolbox. Take a look at Create Command-line Launcher Intellij not found to find out how to set it in Toolbox.
Rider, in my case at least, and I installed it on Linux via snap, comes with a built-in rider command. It does open Rider, however, the issue is that the terminal becomes an output for logs from Rider. Additionally, as soon as I close the terminal, Rider gets closed as well. I guess the Rider process becomes a child process of the shell instance that I used to invoke it.

How to install all VS Code workspace extensions programatically

When VS Code opens in a folder with .vscode/extensions.json present the user has the option to Install All recommended extensions.
How can the Install All function be invoked programatically (i.e. without human interaction) using the command line or VS Code API?
It doesn't look like the "Install All" action is associated with a command you could call via the vscode.commands API.
The easiest solution is probably to parse .vscode/extensions.json yourself. You could then simply run code --install-extension <extension-id> for each of the extension IDs you find.

Command line serial terminal

I'm using Eclipse to develop application for embedded systems.
One of the options of Eclipse configurations are "Program to run after programming/building"
Usually, on that textbox it's the path to our .exe generated before, but on this case I want to run a serial port terminal, like this:
terminal -COM=9 -baud=9600...
My goal here it's to have that terminal printing on Eclipse console. Is that possible?
You could use the Target Management platform to achieve this result. Sadly, I did not try this, so cannot tell whether it works or not, but should be according to the about page.