Class: Convoy::Formatter::DefaultHelpFormatter
- Inherits:
-
Object
- Object
- Convoy::Formatter::DefaultHelpFormatter
- Defined in:
- lib/convoy/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/convoy/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/convoy/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/convoy/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 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/convoy/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) # Uncomment the following line if you want the screen # to be cleared before the --help messages show. # # system('clear') puts StreamOutputFormatter.new($stdout, :max_output_width => Terminal.width) do |f| if setup.summary_for != '' && !setup.summary_for.nil? f.puts setup.summary_for, :newlines => 2 end # if (setup.description_for != '' && !setup.description_for.nil?) && current_command.summary == setup.summary_for # f.indent(4) do |f_inner| # f_inner.puts setup.description_for, :newlines => 2 # end # end name_help(current_command, f) version_help(current_command, f) usage_help(current_command, f) commands_help(commands, f) (, f) end end |