Class: Escort::Formatter::DefaultHelpFormatter

Inherits:
Object
  • Object
show all
Defined in:
lib/escort/formatter/default_help_formatter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#contextObject (readonly)

Returns the value of attribute context.



4
5
6
# File 'lib/escort/formatter/default_help_formatter.rb', line 4

def context
  @context
end

#setupObject (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



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 = 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)
    options_help(options, f)
    commands_help(commands, f)
  end
end