Sha256: 1ddacde778e9e5cad4096c8d08635078121fe22e2c75c04bdc273cdf7b297e99

Contents?: true

Size: 596 Bytes

Versions: 2

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

2 entries across 2 versions & 1 rubygems

Version Path
tty-command-0.10.1 lib/tty/command/dry_runner.rb
tty-command-0.10.0 lib/tty/command/dry_runner.rb