SYSTEM.args is not available.
Christoph
$ cat test-argv.js
#!/usr/bin/gsr
print(require('system').args)
$ gsr -f test-argv.js
test-argv.js
$ gsr -f test-argv.js foo
test-argv.js,foo
$ gsr -f test-argv.js foo bar baz
test-argv.js,foo,bar,baz
If you have executable permission, you can also invoke this way:
$ ./test-argv.js hello world
./test-argv.js,hello,world
This demonstrates what I mean by "path to your command"
$ `pwd`/test-argv.js hello world
/home/hdon/test-argv.js,hello,world
If you need anything else we're also in #gpsee on irc.freenode.net
var SYSTEM = require("system");
> which contains an "args" property that is an array
> where element 0 is the path of your command (not the interpreter,
> which is gsr) and each following element is each command-line argument
> given after the command. ergo:
Hmm.
for(var i in SYSTEM)
print("property: "+ i);
Yields:
key: stdin
key: stdout
key: stderr
key: platform
key: global
key: env
No "args", but SYSTEM.args is indeed there.
Thanks!
Christoph
Thanks for finding this out :)
Not all properties are enumerable in Javascript. This means that
several means of property "discovery" (formally called enumeration in
Javascript) overlook those properties.
Please try print(require("system").args) and see what you get!
> Please try print(require("system").args) and see what you get!
All good.
Christoph