forked from GoogleChromeLabs/psi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cli.js
executable file
·43 lines (38 loc) · 1015 Bytes
/
cli.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
43
#!/usr/bin/env node
'use strict';
var meow = require('meow');
var updateNotifier = require('update-notifier');
var psi = require('./');
var cli = meow({
help: [
'Usage',
' a11y <url>',
'',
'Example',
' a11y todomvc.com',
'',
'Options',
' --key Google API Key. By default the free tier is used.',
' --strategy Strategy to use when analyzing the page: mobile|desktop',
' --format Output format: cli|json|tap',
' --locale Locale results should be generated in.',
' --threshold Threshold score to pass the PageSpeed test.',
' --prettyprint Pretty print the result.'
].join('\n')
});
updateNotifier({pkg: cli.pkg}).notify();
if (!cli.input[0]) {
console.error('Please supply an URL');
process.exit(1);
}
psi.output(cli.input[0], cli.flags, function (err, res) {
if (err) {
if (err.noStack) {
console.error(err.message);
process.exit(1);
} else {
throw err;
}
}
process.exit(0);
});