Module: UltraCommandLine::Commands::HelpFormatter
- Included in:
- SubCommand
- Defined in:
- lib/ultra_command_line/commands/help_formatter.rb
Constant Summary collapse
- DEFAULT_SEPARATOR_WIDTH =
80
- DEFAULT_SEPARATOR_FILLER =
'-'.freeze
- DEFAULT_TITLE =
'Options'.freeze
Instance Attribute Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#separator_filler ⇒ Object
20 21 22 |
# File 'lib/ultra_command_line/commands/help_formatter.rb', line 20 def separator_filler @separator_filler ||= DEFAULT_SEPARATOR_FILLER end |
#separator_width ⇒ Object
12 13 14 |
# File 'lib/ultra_command_line/commands/help_formatter.rb', line 12 def separator_width @separator_width ||= DEFAULT_SEPARATOR_WIDTH end |
Instance Method Details
#help ⇒ Object
24 25 26 27 28 29 30 31 32 |
# File 'lib/ultra_command_line/commands/help_formatter.rb', line 24 def help output = [] output << unless .empty? output << build_separator(title) output.concat .map(&:help_line) end output end |
#title ⇒ Object
16 17 18 |
# File 'lib/ultra_command_line/commands/help_formatter.rb', line 16 def title name.nil? || name.empty? ? DEFAULT_TITLE : name end |