Aliasing crawler depth to '-d' for easy of use. (#925)

This commit is contained in:
Jonathan Lee 2016-05-14 15:07:00 -04:00 committed by Peter Hedenskog
parent 906e538877
commit d808112738
2 changed files with 7 additions and 2 deletions

View File

@ -35,7 +35,6 @@ if (log.isEnabledFor(log.CRITICAL)) { // TODO change the threshold to VERBOSE be
log.info('Versions OS: %s sitespeed.io: %s browsertime: %s coach: %s', os.platform() + ' ' + os.release(), packageInfo.version, packageInfo.dependencies.browsertime, packageInfo.dependencies.webcoach);
// FIXME need to consider aliases, e.g. -d => --crawler.depth
loader.parsePluginNames(parsed.raw)
.then((pluginNames) => {
if (allInArray(['browsertime', 'coach'], pluginNames)) {

View File

@ -74,7 +74,8 @@ module.exports.parseCommandLine = function parseCommandLine() {
/*
Crawler options
*/
.option('crawler.depth', {
.option('d', {
alias: 'crawler.depth',
describe: 'How deep to crawl (1=only one page, 2=include links from first page, etc.)',
group: 'Crawler'
})
@ -254,6 +255,11 @@ module.exports.parseCommandLine = function parseCommandLine() {
}
// End hack
// FIXME: Find a solution that would work for all aliasing
if(argv.d) {
rawArgv = merge({}, {"crawler": {"depth": argv.d}}, rawArgv);
}
return {
url: argv._[0],
options: argv,