lib/tty/command/printers/quiet.rb in tty-command-0.7.0 vs lib/tty/command/printers/quiet.rb in tty-command-0.8.0
- old
+ new
@@ -10,15 +10,29 @@
def print_command_start(cmd)
# quiet
end
- def print_command_exit(cmd, *args)
+ def print_command_out_data(cmd, *args)
+ write(cmd, args.join(' '), out_data)
+ end
+
+ def print_command_err_data(cmd, *args)
+ write(cmd, args.join(' '), err_data)
+ end
+
+ def print_command_exit(cmd, status, *args)
+ unless !cmd.only_output_on_error || status.zero?
+ output << out_data
+ output << err_data
+ end
+
# quiet
end
- def write(message)
- output << message
+ def write(cmd, message, data = nil)
+ target = (cmd.only_output_on_error && !data.nil?) ? data : output
+ target << message
end
end # Progress
end # Printers
end # Command
end # TTY