-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcli.js
More file actions
executable file
·62 lines (52 loc) · 1.19 KB
/
cli.js
File metadata and controls
executable file
·62 lines (52 loc) · 1.19 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/usr/bin/env node
'use strict';
const log = require('xa');
const meow = require('meow');
const {mrt, diffboard} = require('.');
const cli = meow(`
Usage
$ mrt <testUrl> [refUrl]
Options
--keys-only, -k Only compare keys in metadata object
--diff-board, -b Generates an HTML report to view results
--path, -p Defines where the data/results should be stored
Examples
$ mrt https://mrtoverflow.com
$ mrt https://mrtoverflow.com --keys-only
$ mrt https://qa-mrtoverflow.com https://dev-mrtoverflow.com
$ mrt https://qa-mrtoverflow.com https://dev-mrtoverflow.com --keys-only
`, {
flags: {
keysOnly: {
type: 'boolean',
alias: 'k',
defualt: false
},
path: {
type: 'String',
alias: 'p',
default: null
},
diffBoard: {
type: 'boolean',
alias: 'b',
defualt: false
}
}
});
const options = {};
const {path, keysOnly, diffBoard} = cli.flags;
if (path) {
options.path = path;
}
if (keysOnly) {
options.keysOnly = keysOnly;
}
if (cli.input.length === 0) {
log.error('Please provide URL to test or use --help for usage.', {silent: true});
}
mrt(options, ...cli.input).then(() => {
if (diffBoard) {
diffboard(options);
}
});