forked from cnumr/GreenIT-Analysis-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
greenit
105 lines (104 loc) · 2.88 KB
/
greenit
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#!/usr/bin/env node
"use strict";
const yargs = require('yargs/yargs')
const { hideBin } = require('yargs/helpers')
const sizes = require('./sizes.js');
yargs(hideBin(process.argv))
.command('analyse [url_input_file] [report_output_file]', 'Run the analysis', (yargs) => {
yargs
.positional('url_input_file', {
describe: 'YAML file path listing all URL',
default: "url.yaml"
})
.positional('report_output_file', {
describe: 'Report output file path',
default: "results.xlsx"
})
.option('timeout', {
alias: 't',
type: 'number',
description: 'Timeout for an analysis of a URL in ms',
default: 180000
})
.option('retry', {
alias: 'r',
type: 'number',
description: 'Number of retry when an analysis of a URL fail',
default: 2
})
.option('max_tab', {
type: 'number',
description: 'Number of concurrent analysis',
default: 40
})
.option('worst_pages', {
type: 'number',
description: 'Number of displayed worst pages',
default: 5
})
.option('worst_rules', {
type: 'number',
description: 'Number of displayed worst rules',
default: 5
})
.option('login', {
type: 'string',
alias:'l',
description: 'Path to YAML file with login informations'
})
.option('device', {
alias:'d',
description: 'Hardware to simulate',
choices:Object.keys(sizes),
default: "desktop"
})
.option('proxy', {
alias: 'p',
type: 'string',
description: 'Path to YAML file with proxy configuration to apply in Chromium'
})
.option('format', {
alias: 'f',
type: 'string',
description: 'Report format : Possible choices : xlsx (excel), html, influxdb'
})
.option('headers', {
alias: 'h',
type: 'string',
description: 'Headers HTTP to configure to analyze url',
})
.option('influxdb_hostname', {
type: 'string'
})
.option('influxdb_bucket', {
type: 'string'
})
.option('influxdb_token', {
type: 'string'
})
.option('influxdb_org', {
type: 'string'
})
}, (argv) => {
require("./commands/analyse.js")(argv)
})
.command('parseSitemap <sitemap_url> [yaml_output_file]', 'Parse sitemap to a YAML file', (yargs) => {
yargs
.positional('sitemap_url', {
describe: 'URL to the sitemap.xml file',
})
.positional('yaml_output_file', {
describe: 'Output file path',
default: "url.yaml"
})
}, (argv) => {
require("./commands/sitemapParser.js")(argv)
})
.option('ci', {
type: 'boolean',
description: 'Disable progress bar to work with GitLab CI'
})
.strict()
.demandCommand()
.help()
.argv