diff --git a/bin/sitespeed.js b/bin/sitespeed.js index d4b3356ca..dd8c5587b 100755 --- a/bin/sitespeed.js +++ b/bin/sitespeed.js @@ -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)) { diff --git a/lib/support/cli.js b/lib/support/cli.js index da13b88b6..d4418262f 100644 --- a/lib/support/cli.js +++ b/lib/support/cli.js @@ -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,