Class: Browserctl::Commands::Screenshot

Inherits:
Object
  • Object
show all
Extended by:
CliOutput
Defined in:
lib/browserctl/commands/screenshot.rb

Class Method Summary collapse

Methods included from CliOutput

print_result

Class Method Details

.run(client, args) ⇒ Object



11
12
13
14
15
16
17
18
19
# File 'lib/browserctl/commands/screenshot.rb', line 11

def self.run(client, args)
  opts = Optimist.options(args) do
    banner "Usage: browserctl shot <page> [--out PATH] [--full]"
    opt :out,  "Output file path",   type: :string, short: "-o"
    opt :full, "Capture full page",  default: false, short: "-f"
  end
  name = args.shift or abort "usage: browserctl shot <page> [--out PATH] [--full]"
  print_result(client.screenshot(name, path: opts[:out], full: opts[:full]))
end