Class: Binder::Help
Overview
Public: [Command] Displays the help for ‘arb`. Used via the `arb` command.
Instance Method Summary
collapse
Methods inherited from Strategy
alias_class, #justify_size, #merge_options_aliases
Instance Method Details
#description ⇒ Object
29
30
31
|
# File 'lib/cli/commands/help.rb', line 29
def description
"Displays the help"
end
|
#execute(args) ⇒ Object
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/cli/commands/help.rb', line 6
def execute args
instructions = []
help_topics = merge_options_aliases
help_topics.each do |topic|
binder = Module.nesting.last
cmd_name = topic.split(" ").last.gsub(/^-*/, '').capitalize
command = binder.const_get(cmd_name)
cmd_description = command.new.description
instructions << format_instruction(topic.to_s, cmd_description)
end
Version.new.execute(nil) + "\n" +
instructions.join("\n")
end
|
25
26
27
|
# File 'lib/cli/commands/help.rb', line 25
def format_instruction name, description
" #{name.ljust(justify_size).colorize(:green)} - #{description}"
end
|