How can I pass arguments to a gjs script? I wan to to call a script with:
gjs my-script.js foo
and in the script I want to get foo
. In node.js I would use process.argv
but this is obviously not possible in gjs.
Any help is much appreciated.
How can I pass arguments to a gjs script? I wan to to call a script with:
gjs my-script.js foo
and in the script I want to get foo
. In node.js I would use process.argv
but this is obviously not possible in gjs.
Any help is much appreciated.
Found it now out. You can get the passed arguments with ARGV
. See Command line arguments in GJS (1/) | by Maicmarin | Medium
In recent GJS System.programArgs
might be a better way to do this, because in apps where GJS is embedded ARGV
might not be defined.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.