Class: DevSystem::InputCommand

Inherits:
Command show all
Defined in:
lib/dev_system/sub/command/input_commands/input_command.rb

Direct Known Subclasses

HighlineInputCommand, TtyInputCommand

Class Method Summary collapse

Methods inherited from Command

#call, get_command_signatures

Methods inherited from Liza::Controller

color, inherited, on_connected

Methods inherited from Liza::Unit

const_missing, division, part, system, #system, test_class

Class Method Details

.call(args) ⇒ Object



9
10
11
# File 'lib/dev_system/sub/command/input_commands/input_command.rb', line 9

def self.call args
  log "args = #{args.inspect}"
end

.pick_one(title, options = ["Yes", "No"]) ⇒ Object



13
14
15
16
17
18
# File 'lib/dev_system/sub/command/input_commands/input_command.rb', line 13

def self.pick_one title, options = ["Yes", "No"]
  log "#{title} #{options.inspect}"

  s = Kernel.gets.chomp.downcase
  options.find { _1.downcase.start_with? s } || options.first
end