-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnodalyzer-cmd.js
executable file
·42 lines (38 loc) · 1.14 KB
/
nodalyzer-cmd.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#! /usr/bin/env node
var nodalyzer = require('nodalyzer'),
minimist = require('minimist'),
argv = minimist(process.argv.slice(2)),
nport = argv.nport || 8125,
usage = function () {
console.log('Usage: nodalyzer [-options] -- url..');
console.log('-v, --verbose\t\tincrease verbose, default false');
console.log(' --nport\t\tport number to use for injecting js files, default 8125');
console.log(' --help\t\tprint this text and exit');
console.log();
};
if (argv.help || argv._.length === 0) {
usage();
process.exit(0);
}
nodalyzer.init(function(status) {
if (status === true) {
argv._.forEach(function (url) {
nodalyzer.get(url, function (err, data) {
if (err) {
console.error(err);
} else {
console.log(JSON.stringify(data));
}
});
});
nodalyzer.close();
} else {
console.error('Failed to init nodalyzer.');
}
}, {
verbose: argv.verbose || argv.v || false,
nport: nport,
dnodeOpts: {
weak: false,
},
});