43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
# File 'lib/shellpress/cli.rb', line 43
def help(*commands)
if commands.empty?
ks = Shellpress.constants.map { |k| Shellpress.const_get(k) }
ks = ks.sort_by { |k| k::ORDER }
ks.reject { |k| self.class == k || k == Shellpress::Thor }.each do |klass|
print_table_for_class(klass)
end
say "Use `#{prefix(self.class)} help [COMMAND] [SUBCOMMAND]' to learn more."
else
cmd = commands[0]
klass = constantize(cmd)
unless klass
say "Unknown command `#{cmd}'."
else
klass.new.help(*commands[1..-1])
end
end
end
|