neutralinojs

How to process commandline arguments in neutralinojs


There is some content that is served from one program that opens up neutralino app using commands. I would like to pass my custom command line arguments to the neutralino app whenever it is run for example;

neu run -- --serv=127.0.0.1:8000

Solution

  • Neutralinojs provides command-line arguments via the NL_ARGS global variable. You can see all supported global variables from the documentation.

    To obtain the command-line argument you need to find it from the NL_ARGS array that contains all command-line arguments. Neutralinojs doesn't provide a built-in parser for command-line arguments. Therefore, you need to split and get the value from --serv=value.