Module: CommandKit::Printing
- Includes:
- Stdio
- Included in:
- Arguments, BugReport, Command, Completion::Install, ExceptionHandler, Open, Options::Parser
- Defined in:
- lib/command_kit/printing.rb,
lib/command_kit/printing/lists.rb,
lib/command_kit/printing/fields.rb,
lib/command_kit/printing/indent.rb,
lib/command_kit/printing/tables.rb,
lib/command_kit/printing/tables/style.rb,
lib/command_kit/printing/tables/row_builder.rb,
lib/command_kit/printing/tables/border_style.rb,
lib/command_kit/printing/tables/cell_builder.rb,
lib/command_kit/printing/tables/table_builder.rb,
lib/command_kit/printing/tables/table_formatter.rb
Overview
Provides printing methods.
Defined Under Namespace
Modules: Fields, Indent, Lists, Tables
Constant Summary collapse
- EOL =
Platform independent new-line constant
$/
Instance Method Summary collapse
-
#print_error(message) ⇒ Object
Prints the error message to stderr.
-
#print_exception(error) ⇒ Object
Prints an exception to stderr.
Methods included from Stdio
#abort, #gets, #initialize, #print, #printf, #putc, #puts, #readline, #readlines, #stderr, #stdin, #stdout
Instance Method Details
#print_error(message) ⇒ Object
Prints the error message to stderr.
35 36 37 38 39 40 41 42 43 |
# File 'lib/command_kit/printing.rb', line 35 def print_error() if respond_to?(:command_name) # if #command_name is available, prefix all error messages with it stderr.puts "#{command_name}: #{}" else # if #command_name is not available, just print the error message as-is stderr.puts end end |
#print_exception(error) ⇒ Object
Prints an exception to stderr.
62 63 64 |
# File 'lib/command_kit/printing.rb', line 62 def print_exception(error) print_error error.(highlight: stderr.tty?) end |