lib/tty/command/dry_runner.rb in tty-command-0.4.0 vs lib/tty/command/dry_runner.rb in tty-command-0.5.0
- old
+ new
@@ -3,14 +3,20 @@
require_relative 'result'
module TTY
class Command
class DryRunner
- def initialize(printer)
+ attr_reader :cmd
+
+ def initialize(cmd, printer)
+ @cmd = cmd
@printer = printer
end
- def run(cmd)
+ # Show command without running
+ #
+ # @api public
+ def run!(&block)
cmd.to_command
message = "#{@printer.decorate('(dry run)', :blue)} "
message << @printer.decorate(cmd.to_command, :yellow, :bold)
@printer.write(message, cmd.uuid)
Result.new(0, '', '')