Class: Browserctl::Commands::ImportCookies

Inherits:
Object
  • Object
show all
Defined in:
lib/browserctl/commands/import_cookies.rb

Class Method Summary collapse

Class Method Details

.run(client, args) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/browserctl/commands/import_cookies.rb', line 6

def self.run(client, args)
  page = args.shift or abort "usage: browserctl import-cookies <page> <path>"
  path = args.shift or abort "usage: browserctl import-cookies <page> <path>"
  begin
    result = client.import_cookies(page, path)
  rescue StandardError => e
    warn "Error: #{e.message}"
    exit 1
  end
  if result[:error]
    warn "Error: #{result[:error]}"
    exit 1
  end
  puts result.to_json
end