Class: Ergane::HelpFormatter

Inherits:
Object
  • Object
show all
Defined in:
lib/ergane/help_formatter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(command_class, command_path: []) ⇒ HelpFormatter

Returns a new instance of HelpFormatter.



7
8
9
10
# File 'lib/ergane/help_formatter.rb', line 7

def initialize(command_class, command_path: [])
  @command_class = command_class
  @command_path = command_path
end

Instance Attribute Details

#command_classObject (readonly)

Returns the value of attribute command_class.



5
6
7
# File 'lib/ergane/help_formatter.rb', line 5

def command_class
  @command_class
end

#command_pathObject (readonly)

Returns the value of attribute command_path.



5
6
7
# File 'lib/ergane/help_formatter.rb', line 5

def command_path
  @command_path
end

Instance Method Details

#formatObject



12
13
14
15
16
17
18
19
20
21
# File 'lib/ergane/help_formatter.rb', line 12

def format
  [
    description_section,
    version_section,
    usage_section,
    subcommands_section,
    options_section,
    arguments_section
  ].compact.join("\n\n") + "\n"
end