Sha256: 32c50738bbd273fc8a3c1a4defe42de8fcf87ac32d093951f8c9ff00f1abb2a6

Contents?: true

Size: 561 Bytes

Versions: 2

Compression:

Stored size: 561 Bytes

Contents

require 'pdk'
require 'tty/prompt'

module PDK
  module CLI
    module Util
      class CommandRedirector < TTY::Prompt::AnswersCollector
        attr_accessor :command

        def pastel
          @pastel ||= Pastel.new
        end

        def target_command(cmd)
          @command = cmd
        end

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pdk-2.7.1 lib/pdk/cli/util/command_redirector.rb
pdk-2.7.0 lib/pdk/cli/util/command_redirector.rb