Merge pull request #304 from GoogleChrome/clioutputoptions

Improve CLI flags output
This commit is contained in:
Paul Irish 2016-05-10 13:22:59 -07:00
Родитель d3b8daf561 ec6e0fa1e3
Коммит d5060186c6
2 изменённых файлов: 25 добавлений и 14 удалений

Просмотреть файл

@ -31,25 +31,35 @@ if (semver.lt(process.version, '5.0.0')) {
process.exit(1);
}
const formatOptions = Object.values(Printer.OUTPUT_MODE).join(', ');
const cli = meow(`
Usage
Usage:
lighthouse [url]
Options
--help Show this help
--version Current version of package
--verbose Displays verbose logging
--quiet Displays no progress or debug logs
--mobile Emulates a Nexus 5X (default=true)
--load-page Loads the page (default=true)
--save-trace Save the trace contents to disk
--save-artifacts Generate network dependency graph
--output How to output the page(default=pretty)
--output-path The location to output the response(default=stdout)
Basic:
--help Show this help
--version Current version of package
Logging:
--verbose Displays verbose logging
--quiet Displays no progress or debug logs
Run Configuration:
--mobile Emulates a Nexus 5X (default=true)
--load-page Loads the page (default=true)
--save-trace Save the trace contents to disk
--save-artifacts Generate network dependency graph
Output:
--output Reporter for the results
Reporter options: ${formatOptions} (default=pretty)
--output-path The file path to output the results (default=stdout)
Example: --output-path=./lighthouse-results.html
`);
const url = cli.input[0] || 'https://pwa.rocks/';
const outputMode = cli.flags.output || 'pretty';
const outputMode = cli.flags.output || Printer.OUTPUT_MODE.pretty;
const outputPath = cli.flags.outputPath || 'stdout';
const flags = cli.flags;

Просмотреть файл

@ -169,5 +169,6 @@ module.exports = {
checkOutputMode,
checkOutputPath,
createOutput,
write
write,
OUTPUT_MODE
};