Sha256: 2dcab73ddb4e52842fc5b14d7d2ebd7fc792d9357b96c01cebdf0222ed0a7b50

Contents?: true

Size: 609 Bytes

Versions: 2

Compression:

Stored size: 609 Bytes

Contents

# encoding: utf-8
# 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(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.7.0 lib/tty/command/dry_runner.rb
tty-command-0.6.0 lib/tty/command/dry_runner.rb