Class: Rpremote::ConfigShow

Inherits:
Object
  • Object
show all
Defined in:
lib/rpremote/config_show.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(defaults:, output:) ⇒ ConfigShow

Returns a new instance of ConfigShow.



14
15
16
17
# File 'lib/rpremote/config_show.rb', line 14

def initialize(defaults:, output:)
  @defaults = defaults
  @output = output
end

Class Method Details

.run(args, defaults:, output:) ⇒ Object



10
11
12
# File 'lib/rpremote/config_show.rb', line 10

def self.run(args, defaults:, output:)
  new(defaults: defaults, output: output).run(args)
end

Instance Method Details

#run(args) ⇒ Object

Raises:

  • (ArgumentError)


19
20
21
22
23
24
25
26
27
28
# File 'lib/rpremote/config_show.rb', line 19

def run(args)
  options = effective_options
  parser = option_parser(options)
  parser.parse!(args)
  raise ArgumentError, "usage: rpremote config show [options]" unless args.empty?
  raise ArgumentError, "--baud must be positive" unless options[:baud].positive?
  raise ArgumentError, "--timeout must be positive" unless options[:timeout].positive?

  print_options(options)
end