diff --git a/lib/cli/cli.js b/lib/cli/cli.js index ca2d720c0..0d5a563a9 100644 --- a/lib/cli/cli.js +++ b/lib/cli/cli.js @@ -38,7 +38,7 @@ try { } catch (e) { if (e instanceof SyntaxError) { console.error( - 'Could not parse the config JSON file ' + + 'Error: Could not parse the config JSON file ' + configPath + '. Is the file really valid JSON?' ); @@ -53,7 +53,7 @@ function validateInput(argv) { const majorVersion = fullVersion.split('.')[0]; if (majorVersion < minVersion) { return ( - 'You need to have at least NodeJS version ' + + 'Error: You need to have at least NodeJS version ' + minVersion + ' to run sitespeed.io. You are using version ' + fullVersion @@ -61,19 +61,19 @@ function validateInput(argv) { } if (argv.headless && (argv.video || argv.visualMetrics)) { - return 'You cannot combine headless with video/visualMetrics because they need a screen to work.'; + return 'Error: You cannot combine headless with video/visualMetrics because they need a screen to work.'; } if (Array.isArray(argv.browsertime.iterations)) { - return 'Ooops you passed number of iterations twice, remove one of them and try again.'; + return 'Error: Ooops you passed number of iterations twice, remove one of them and try again.'; } if (Array.isArray(argv.browser)) { - return 'You can only run with one browser at a time.'; + return 'Error: You can only run with one browser at a time.'; } if (argv.crawler && argv.crawler.depth && argv.multi) { - return 'Crawl do not work running in multi mode.'; + return 'Error: Crawl do not work running in multi mode.'; } if ( @@ -81,7 +81,7 @@ function validateInput(argv) { argv._ && cliUtil.getURLs(argv._).length !== toArray(argv.urlAlias).length ) { - return 'You have a miss match between number of alias and URLs.'; + return 'Error: You have a miss match between number of alias and URLs.'; } if ( @@ -89,7 +89,7 @@ function validateInput(argv) { argv._ && cliUtil.getURLs(argv._).length !== toArray(argv.groupAlias).length ) { - return 'You have a miss match between number of alias for groups and URLs.'; + return 'Error: You have a miss match between number of alias for groups and URLs.'; } // validate URLs/files @@ -100,7 +100,11 @@ function validateInput(argv) { try { fs.statSync(urlOrFile); } catch (e) { - return urlOrFile + ' does not exist, is the path to the file correct?'; + return ( + 'Error: ' + + urlOrFile + + ' does not exist, is the path to the file correct?' + ); } } } @@ -112,13 +116,13 @@ function validateInput(argv) { tools => friendlynames[tools][m] && friendlynames[tools][m][k] ) ) { - return 'Require summary page metrics to be from given array'; + return 'Error: Require summary page metrics to be from given array'; } } for (let metric of toArray(argv.html.summaryBoxes)) { if (htmlConfig.html.summaryBoxes.indexOf(metric) === -1) { - return `${metric} is not part of summary box metric.`; + return `Error: ${metric} is not part of summary box metric.`; } } @@ -132,7 +136,9 @@ function validateInput(argv) { ); argv.html.summaryBoxesThresholds = JSON.parse(box); } catch (e) { - return 'Could not read ' + argv.html.summaryBoxesThresholds + ' ' + e; + return ( + 'Error: Could not read ' + argv.html.summaryBoxesThresholds + ' ' + e + ); } }