Explorar o código

Add device selection option to CLI

Gaël Métais %!s(int64=10) %!d(string=hai) anos
pai
achega
67615719ae
Modificáronse 1 ficheiros con 4 adicións e 0 borrados
  1. 4 0
      bin/cli.js

+ 4 - 0
bin/cli.js

@@ -12,6 +12,7 @@ var cli = meow({
         '  yellowlabtools <url> <options>',
         '',
         'Options:',
+        '  --device             Use "phone" or "tablet" to simulate a mobile device (by user-agent and viewport size).',
         '  --screenshot         Will take a screenshot and use this value as the output path. It needs to end with ".png".',
         '  --js-deep-analysis   When activated, the javascriptExecutionTree will contain sub-requests.',
         ''
@@ -50,6 +51,9 @@ if (cli.flags.jsDeepAnalysis === true || cli.flags.jsDeepAnalysis === 'true') {
     options.jsDeepAnalysis = true;
 }
 
+// Device simulation
+options.device = cli.flags.device || 'desktop';
+
 
 (function execute(url, options) {
     'use strict';