javascriptnode.jsphantomjsslimerjs

How to pass cli args in Slimerjs?


I have a process in Slimerjs that I run through a child_process Nodejs and I need to pass it some arguments.

I know how to use cli args with Nodejs

var args = process.argv.slice(2);

And also with Casper

var casper = require("casper").create();

casper.echo("Casper CLI passed args:");
require("utils").dump(casper.cli.args);

casper.echo("Casper CLI passed options:");
require("utils").dump(casper.cli.options);

casper.exit();

However, I don't know how to use them in Slimerjs. Any ideas?

Thanks


Solution

  • SlimerJS documentation is pretty vocal about using arguments: https://docs.slimerjs.org/current/api/system.html#args

    var system = require('system')
    var numberOfArg = system.args.length;
    var thirdArgument = system.args[2];