Class: TTY::Command::Printers::Quiet
Instance Attribute Summary collapse
Attributes inherited from Abstract
#err_data, #out_data
Instance Method Summary
collapse
Methods inherited from Abstract
#initialize
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
9
10
11
|
# File 'lib/tty/command/printers/quiet.rb', line 9
def options
@options
end
|
#output ⇒ Object
Returns the value of attribute output.
9
10
11
|
# File 'lib/tty/command/printers/quiet.rb', line 9
def output
@output
end
|
Instance Method Details
#print_command_err_data(cmd, *args) ⇒ Object
19
20
21
|
# File 'lib/tty/command/printers/quiet.rb', line 19
def print_command_err_data(cmd, *args)
write(cmd, args.join(' '), err_data)
end
|
#print_command_exit(cmd, status, *args) ⇒ Object
23
24
25
26
27
28
29
30
|
# File 'lib/tty/command/printers/quiet.rb', line 23
def print_command_exit(cmd, status, *args)
unless !cmd.only_output_on_error || status.zero?
output << out_data
output << err_data
end
end
|
#print_command_out_data(cmd, *args) ⇒ Object
15
16
17
|
# File 'lib/tty/command/printers/quiet.rb', line 15
def print_command_out_data(cmd, *args)
write(cmd, args.join(' '), out_data)
end
|
#print_command_start(cmd) ⇒ Object
11
12
13
|
# File 'lib/tty/command/printers/quiet.rb', line 11
def print_command_start(cmd)
end
|
#write(cmd, message, data = nil) ⇒ Object
32
33
34
35
|
# File 'lib/tty/command/printers/quiet.rb', line 32
def write(cmd, message, data = nil)
target = (cmd.only_output_on_error && !data.nil?) ? data : output
target << message
end
|