Class: Snaptoken::Commands::Help
Instance Attribute Summary
Attributes inherited from BaseCommand
#config
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from BaseCommand
#git_to_litdiff!, inherited, #initialize, #litdiff_to_git!, #needs!, #parseopts!
Class Method Details
.name ⇒ Object
2
3
4
|
# File 'lib/snaptoken/commands/help.rb', line 2
def self.name
"help"
end
|
.summary ⇒ Object
6
7
8
9
|
# File 'lib/snaptoken/commands/help.rb', line 6
def self.summary
"Print out list of commands, or get help\n" +
"on a specific command."
end
|
.usage ⇒ Object
11
12
13
|
# File 'lib/snaptoken/commands/help.rb', line 11
def self.usage
"[<command>]"
end
|
Instance Method Details
#run ⇒ Object
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
# File 'lib/snaptoken/commands/help.rb', line 18
def run
if @args.empty?
puts "Usage: leg <command> [args...]"
puts
puts "Commands:"
Snaptoken::Commands::LIST.each do |cmd|
puts " #{cmd.name} #{cmd.usage}"
cmd.summary.split("\n").each do |line|
puts " #{line}"
end
end
puts
puts "For more help on a specific command, run `leg help <command>`."
elsif cmd = Snaptoken::Commands::LIST.find { |cmd| cmd.name == @args.first }
cmd.new(["--help"], @tutorial)
else
puts "There is no '#{@args.first}' command."
end
end
|
#setopts!(o) ⇒ Object
15
16
|
# File 'lib/snaptoken/commands/help.rb', line 15
def setopts!(o)
end
|