Sha256: 40ab31b4239f5137d9c742f882d382e4826d9564127c2365aae47ec7e5ab0519

Contents?: true

Size: 596 Bytes

Versions: 3

Compression:

Stored size: 596 Bytes

Contents

# frozen_string_literal: true

require_relative 'result'

module TTY
  class Command
    class DryRunner
      attr_reader :cmd

      def initialize(cmd, printer)
        @cmd     = cmd
        @printer = printer
      end

      # Show command without running
      #
      # @api public
      def run!(*)
        cmd.to_command
        message = "#{@printer.decorate('(dry run)', :blue)} " +
                  @printer.decorate(cmd.to_command, :yellow, :bold)
        @printer.write(cmd, message, cmd.uuid)
        Result.new(0, '', '')
      end
    end # DryRunner
  end # Command
end # TTY

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
outstand-tty-command-0.10.0 lib/tty/command/dry_runner.rb
outstand-tty-command-0.10.0.pre lib/tty/command/dry_runner.rb
tty-command-0.9.0 lib/tty/command/dry_runner.rb