added cliplay.(js|coffee) to play around with cli arguments handling
Showing
3 changed files
with
36 additions
and
1 deletions
samples/cliplay.coffee
0 → 100644
1 | casper = require("casper").create() | ||
2 | dump = require("utils").dump | ||
3 | |||
4 | # removing default options passed by the Python executable | ||
5 | casper.cli.drop "cli" | ||
6 | casper.cli.drop "casper-path" | ||
7 | |||
8 | if casper.cli.args.length is 0 and Object.keys(casper.cli.options).length is 0 | ||
9 | casper.echo("Pass some args and options to see how they are handled by CasperJS").exit() | ||
10 | |||
11 | casper.echo "Casper CLI passed args:" | ||
12 | dump casper.cli.args | ||
13 | |||
14 | casper.echo "Casper CLI passed options:" | ||
15 | dump casper.cli.options | ||
16 | |||
17 | casper.exit() |
samples/cliplay.js
0 → 100644
1 | var casper = require("casper").create(); | ||
2 | var dump = require("utils").dump; | ||
3 | |||
4 | // removing default options passed by the Python executable | ||
5 | casper.cli.drop("cli"); | ||
6 | casper.cli.drop("casper-path"); | ||
7 | |||
8 | if (casper.cli.args.length === 0 && Object.keys(casper.cli.options).length === 0) { | ||
9 | casper.echo("Pass some args and options to see how they are handled by CasperJS").exit(); | ||
10 | } | ||
11 | |||
12 | casper.echo("Casper CLI passed args:"); | ||
13 | dump(casper.cli.args); | ||
14 | |||
15 | casper.echo("Casper CLI passed options:"); | ||
16 | dump(casper.cli.options); | ||
17 | |||
18 | casper.exit(); | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
-
Please register or sign in to post a comment