Sha256: 1f57483606611221a1697258cc539653e247bfcb6a7d786204a0f81de5139e26

Contents?: true

Size: 536 Bytes

Versions: 24

Compression:

Stored size: 536 Bytes

Contents

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 TTY::Prompt::Reader::InputInterrupt
          nil
        end
      end
    end
  end
end

Version data entries

24 entries across 24 versions & 2 rubygems

Version Path
pdk-1.3.0 lib/pdk/cli/util/command_redirector.rb
pdk-1.2.1 lib/pdk/cli/util/command_redirector.rb
pdk-1.2.0 lib/pdk/cli/util/command_redirector.rb
pdk-1.1.0 lib/pdk/cli/util/command_redirector.rb