Class: Miniflow::TTYCommand::CustomPretty
- Inherits:
-
Printers::Pretty
- Object
- Printers::Pretty
- Miniflow::TTYCommand::CustomPretty
- Defined in:
- lib/miniflow/tty_command.rb
Overview
TTY::Command custom printer
-
change default colors.
Instance Method Summary collapse
- #print_command_err_data(cmd, *args) ⇒ Object
- #print_command_start(cmd, *args) ⇒ Object
- #write(cmd, message, data = nil) ⇒ Object
Instance Method Details
#print_command_err_data(cmd, *args) ⇒ Object
20 21 22 23 |
# File 'lib/miniflow/tty_command.rb', line 20 def print_command_err_data(cmd, *args) = args.map(&:chomp).join(' ') write(cmd, "\t#{decorate(message, :white)}", err_data) end |
#print_command_start(cmd, *args) ⇒ Object
14 15 16 17 18 |
# File 'lib/miniflow/tty_command.rb', line 14 def print_command_start(cmd, *args) = ["Running #{decorate(cmd.to_command, :cyan)}"] << args.map(&:chomp).join(' ') unless args.empty? write(cmd, .join) end |
#write(cmd, message, data = nil) ⇒ Object
25 26 27 28 29 30 31 32 33 |
# File 'lib/miniflow/tty_command.rb', line 25 def write(cmd, , data = nil) cmd_set_uuid = cmd..fetch(:uuid, true) uuid_needed = cmd.[:uuid].nil? ? @uuid : cmd_set_uuid out = [] out << "[#{decorate(cmd.uuid, :green)}] " if uuid_needed && !cmd.uuid.nil? out << "#{message}\n" target = cmd.only_output_on_error && !data.nil? ? data : output target << out.join end |