UNPKG

@qualweb/cli

Version:
26 lines 1.23 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.addViewportOptions = addViewportOptions; const commander_1 = require("commander"); function addViewportOptions(command) { command.option('--mobile', 'Use mobile mode in the browser viewport'); const orientationOption = new commander_1.Option('--orientation <orientation>', 'Orientation of the screen.') .choices(['portrait', 'landscape']) .default('portrait'); command.addOption(orientationOption); command.option('--user-agent <user-agent>', 'Sets a custom user agent for the browser.'); command.option('--viewport-resolution <WIDTHxHEIGHT>', 'Resolution of the browser viewport', (value) => { const matches = /^(?<width>\d+)x(?<height>\d+)$/.exec(value); if (matches === null) { throw new commander_1.InvalidOptionArgumentError('Viewport resolution must be in the format WIDTHxHEIGHT. Both values must be integers.'); } else { return { width: Number.parseInt(matches.groups.width), height: Number.parseInt(matches.groups.height), }; } }); return command; } //# sourceMappingURL=viewport.js.map