Ability to pass additional arguments to Electron via electron-forge-start
See original GitHub issue- I have read the contribution documentation for this project.
- I agree to follow the code of conduct that this project follows, as appropriate.
- I have searched the issue tracker for an issue that matches the one I want to file, without success.
This is less of a bug and more of a suggestion/improvement.
I am working on an Electron application that has two modes of operation (player and editor). By default the player is started unless the --editor
flag is present on the CLI. In that case, the editor is launched.
I would definitely be useful to be able to pass CLI arguments to the Electron application via electron-forge start
.
Currently, passing anything that is not a valid option for electron-forge-start
will cause the command to halt on the fact it doesn’t understand the argument, meaning I have to either package my application to test the CLI flags or launch my application via node_modules/.bin/electron
, which defeats the purpose of electron-forge start
.
Issue Analytics
- State:
- Created 6 years ago
- Comments:11 (7 by maintainers)
Top Results From Across the Web
Ability to pass additional arguments to Electron via ... - GitHub
Currently, passing anything that is not a valid option for electron-forge-start will cause the command to halt on the fact it doesn't understand ......
Read more >How to pass command line argument in electron
I just started using electron. I have a doubt about how to pass command line arguments in electron when I'm using npm start...
Read more >A Comprehensive Guide to Building and Packaging an ...
Building and Packaging an Electron App wasn't as straight forward as I had hoped. This guide aims to help you navigate the complexities...
Read more >Command Line Arguments in ElectronJS - GeeksforGeeks
We can pass Command-line arguments to Electron from outside the application on invoking it or we can simply hard code these values using...
Read more >Electron in Action.pdf - Open Directory Data Archive
Your first Electron application 17 ... Persisting use data and using native Node.js modules 222 ... Additional features of the Electron shell module...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Any chance someone could show an example? I’m having trouble. Executing as follows:
electron-forge start --- arg1value arg2value
Is this the correct format? If so, how can they be accessed in
main.js
? Trying withprocess.argv
to no avail.Electron version:
1.8.2
UPDATE: Ahh, just so #209. For anyone coming to this issue, it’s been updated to require two dashes:
electron-forge start -- arg1value arg2value
They are indeed accessible via
process.argv
Thanks team!
For future searches: you have to use the 2 dashes + 2 dashes for yarn