October 03, 2020
Reading ARGV in electron is as simple as parsing
array from node, as long as reading the CLI arguments will be done only inside
the main process of your electron app. Sometimes though you want to flip some
switches inside the
too, based on what’s passed in the main process’s argv. Maybe change some UI
based on the passed in API environment or even use different endpoints and
That’s the problem definition, which turns out is even longer than the solution itself.
import electron from 'electron' // ARGV from main process console.log(electron.remote.process.argv)
So this is it. Nice and simple.