1 | #!/usr/bin/env node
|
2 |
|
3 | var fs = require('fs');
|
4 | var program = require('commander');
|
5 | var normalizeUrl = require('normalize-url');
|
6 | var getCss = require('..');
|
7 |
|
8 | program
|
9 | .version('0.0.2')
|
10 | .usage('[options] <url>')
|
11 | .option("-j, --json","output downloaded html and css as json")
|
12 | .option("-t, --timeout [ms]","timeout in ms to wait for responses", 30000)
|
13 | .option("-s, --strip_wayback_css","remove wayback toolbar css from internet archive captures")
|
14 | .action(function(url, options) {
|
15 | if(url) {
|
16 | url = normalizeUrl(url, { stripWWW: false });
|
17 | getCss(url, { verbose: true, timeout: options.timeout, stripWayback: options.strip_wayback_css }).then(function(css) {
|
18 | if (options.json){
|
19 | console.log(JSON.stringify(css));
|
20 | }
|
21 | else {
|
22 | console.log(css.css);
|
23 | }
|
24 | });
|
25 | }
|
26 | });
|
27 |
|
28 | program.parse(process.argv);
|