Class: PDK::CLI::Util::CommandRedirector

Inherits:
TTY::Prompt::AnswersCollector
  • Object
show all
Defined in:
lib/pdk/cli/util/command_redirector.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#commandObject

Returns the value of attribute command.



8
9
10
# File 'lib/pdk/cli/util/command_redirector.rb', line 8

def command
  @command
end

Instance Method Details

#pastelObject



10
11
12
# File 'lib/pdk/cli/util/command_redirector.rb', line 10

def pastel
  @pastel ||= Pastel.new
end

#runObject



18
19
20
21
22
23
# File 'lib/pdk/cli/util/command_redirector.rb', line 18

def run
  @prompt.puts _('Did you mean \'%{command}\'?') % { command: pastel.bold(@command) }
  @prompt.yes?('-->')
rescue PDK::CLI::Util::Interview::READER::InputInterrupt
  nil
end

#target_command(cmd) ⇒ Object



14
15
16
# File 'lib/pdk/cli/util/command_redirector.rb', line 14

def target_command(cmd)
  @command = cmd
end