Sha256: 743b9b5916062ba0bb00040df24584f492d9831f58106bf4040ecfdd0e334995

Contents?: true

Size: 614 Bytes

Versions: 3

Compression:

Stored size: 614 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(cmd, message, cmd.uuid)
        Result.new(0, '', '')
      end
    end # DryRunner
  end # Command
end # TTY

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
tty-command-0.8.2 lib/tty/command/dry_runner.rb
tty-command-0.8.1 lib/tty/command/dry_runner.rb
tty-command-0.8.0 lib/tty/command/dry_runner.rb