Module: Fuelcell::Help

Defined in:
lib/fuelcell/help.rb,
lib/fuelcell/help/builder.rb,
lib/fuelcell/help/base_formatter.rb,
lib/fuelcell/help/cmds_formatter.rb,
lib/fuelcell/help/desc_formatter.rb,
lib/fuelcell/help/opts_formatter.rb,
lib/fuelcell/help/usage_formatter.rb

Defined Under Namespace

Classes: BaseFormatter, Builder, CmdsFormatter, DescFormatter, OptsFormatter, UsageFormatter

Class Method Summary collapse

Class Method Details

.generate(root, args = [], width = 80) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/fuelcell/help.rb', line 11

def generate(root, args = [], width = 80)
  data = Builder.new.call(root, args)
  text = UsageFormatter.new(width: width).call(data)

  line = DescFormatter.new(width: width).call(data)
  text << "\n" + line unless line.empty?

  line = OptsFormatter.new(width: width).call(data)
  text << "\n" + line unless line.empty?

  line = CmdsFormatter.new(width: width).call(data)
  text << "\n" + line unless line.empty?
  text
end