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-akerl-1.14.0.1 lib/pdk/cli/util/command_redirector.rb
pdk-1.14.0 lib/pdk/cli/util/command_redirector.rb
pdk-1.13.0 lib/pdk/cli/util/command_redirector.rb
pdk-1.12.0 lib/pdk/cli/util/command_redirector.rb
pdk-1.11.1 lib/pdk/cli/util/command_redirector.rb
pdk-1.11.0 lib/pdk/cli/util/command_redirector.rb
pdk-1.10.0 lib/pdk/cli/util/command_redirector.rb
pdk-akerl-1.9.1.1 lib/pdk/cli/util/command_redirector.rb
pdk-1.9.1 lib/pdk/cli/util/command_redirector.rb
pdk-1.9.0 lib/pdk/cli/util/command_redirector.rb
pdk-akerl-1.8.0.1 lib/pdk/cli/util/command_redirector.rb
pdk-1.8.0 lib/pdk/cli/util/command_redirector.rb
pdk-1.7.1 lib/pdk/cli/util/command_redirector.rb
pdk-1.7.0 lib/pdk/cli/util/command_redirector.rb
pdk-1.6.1 lib/pdk/cli/util/command_redirector.rb
pdk-1.6.0 lib/pdk/cli/util/command_redirector.rb
pdk-1.5.0 lib/pdk/cli/util/command_redirector.rb
pdk-1.4.1 lib/pdk/cli/util/command_redirector.rb
pdk-1.3.2 lib/pdk/cli/util/command_redirector.rb
pdk-1.3.1 lib/pdk/cli/util/command_redirector.rb