Class: PDK::CLI::Util::CommandRedirector
- Inherits:
-
TTY::Prompt::AnswersCollector
- Object
- TTY::Prompt::AnswersCollector
- PDK::CLI::Util::CommandRedirector
- Defined in:
- lib/pdk/cli/util/command_redirector.rb
Instance Attribute Summary collapse
-
#command ⇒ Object
Returns the value of attribute command.
Instance Method Summary collapse
Instance Attribute Details
#command ⇒ Object
Returns the value of attribute command.
7 8 9 |
# File 'lib/pdk/cli/util/command_redirector.rb', line 7 def command @command end |
Instance Method Details
#pastel ⇒ Object
9 10 11 |
# File 'lib/pdk/cli/util/command_redirector.rb', line 9 def pastel @pastel ||= Pastel.new end |
#run ⇒ Object
17 18 19 20 21 22 |
# File 'lib/pdk/cli/util/command_redirector.rb', line 17 def run @prompt.puts _('Did you mean \'%{command}\'?') % { command: pastel.bold(@command) } @prompt.yes?('-->') rescue TTY::Prompt::Reader::InputInterrupt nil end |
#target_command(cmd) ⇒ Object
13 14 15 |
# File 'lib/pdk/cli/util/command_redirector.rb', line 13 def target_command(cmd) @command = cmd end |