Class: Browserctl::Commands::Click
- Inherits:
-
Object
- Object
- Browserctl::Commands::Click
- Extended by:
- CliOutput
- Defined in:
- lib/browserctl/commands/click.rb
Constant Summary
Constants included from CliOutput
Browserctl::Commands::CliOutput::AUTH_REQUIRED_EXIT_CODE
Class Method Summary collapse
Methods included from CliOutput
Class Method Details
.run(client, args) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/browserctl/commands/click.rb', line 11 def self.run(client, args) opts = Optimist.(args) do "Usage: browserctl click <page> <selector>\n " \ "browserctl click <page> --ref <ref>" opt :ref, "Snapshot ref to click", type: :string, short: "-r" end name = args.shift if opts[:ref] abort "usage: browserctl click <page> --ref <ref>" unless name print_result(client.click(name, ref: opts[:ref])) else selector = args.shift abort "usage: browserctl click <page> <selector>" unless name && selector print_result(client.click(name, selector)) end end |