Class: Browserctl::Commands::Fill

Inherits:
Object
  • Object
show all
Extended by:
CliOutput
Defined in:
lib/browserctl/commands/fill.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
20
# File 'lib/browserctl/commands/fill.rb', line 11

def self.run(client, args)
  opts = Optimist.options(args) do
    banner "Usage: browserctl fill <page> <selector> <value>\n       " \
           "browserctl fill <page> --ref <ref> --value <value>"
    opt :ref,   "Snapshot ref to fill", type: :string, short: "-r"
    opt :value, "Value to fill",        type: :string, short: "-V"
  end
  name = args.shift
  opts[:ref] ? fill_by_ref(client, name, opts) : fill_by_selector(client, name, args, opts[:value])
end