UNPKG

888 BPlain TextView Raw
1#!/usr/bin/env node
2
3var fs = require('fs');
4var program = require('commander');
5var normalizeUrl = require('normalize-url');
6var getCss = require('..');
7
8program
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
28program.parse(process.argv);