Class: Escort::Formatter::DefaultHelpFormatter
- Inherits:
-
Object
- Object
- Escort::Formatter::DefaultHelpFormatter
- Defined in:
- lib/escort/formatter/default_help_formatter.rb
Instance Attribute Summary collapse
-
#context ⇒ Object
readonly
Returns the value of attribute context.
-
#setup ⇒ Object
readonly
Returns the value of attribute setup.
Instance Method Summary collapse
-
#initialize(setup, context) ⇒ DefaultHelpFormatter
constructor
A new instance of DefaultHelpFormatter.
- #print(parser) ⇒ Object
Constructor Details
#initialize(setup, context) ⇒ DefaultHelpFormatter
Returns a new instance of DefaultHelpFormatter.
6 7 8 9 |
# File 'lib/escort/formatter/default_help_formatter.rb', line 6 def initialize(setup, context) @setup = setup @context = context end |
Instance Attribute Details
#context ⇒ Object (readonly)
Returns the value of attribute context.
4 5 6 |
# File 'lib/escort/formatter/default_help_formatter.rb', line 4 def context @context end |
#setup ⇒ Object (readonly)
Returns the value of attribute setup.
4 5 6 |
# File 'lib/escort/formatter/default_help_formatter.rb', line 4 def setup @setup end |
Instance Method Details
#print(parser) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/escort/formatter/default_help_formatter.rb', line 11 def print(parser) = Options.new(parser, setup, context) commands = Commands.new(setup, context) current_command = Commands.command_for(setup, context) StreamOutputFormatter.new($stdout, :max_output_width => Terminal.width) do |f| name_help(current_command, f) usage_help(current_command, f) version_help(current_command, f) (, f) commands_help(commands, f) end end |