class Ki::KiInfoCommand
Lists available Ki
commands
Public Instance Methods
execute(ctx, args)
click to toggle source
Finds all commands under /commands and outputs their id and summary
# File lib/cmd/cmd.rb, line 197 def execute(ctx, args) opts.parse(args.empty? ? ["-c"] : args) end
help()
click to toggle source
# File lib/cmd/cmd.rb, line 221 def help <<EOF "#{shell_command}" shows information about Ki. ### Examples #{shell_command} -c #{shell_command} -r ### Parameters #{opts} EOF end
opts()
click to toggle source
# File lib/cmd/cmd.rb, line 201 def opts SimpleOptionParser.new do |opts| opts.on("-c", "--commands", "List commands") do |v| commands = KiCommand::KiExtensions.find(KiCommand::CommandPrefix[0..-2]) commands.each do |id, service_class| puts " #{id[KiCommand::CommandPrefix.size..-1]}: #{service_class.new.summary}" end end opts.on("-r", "--registered", "List all registered extensions") do |v| by_parent = KiCommand::KiExtensions.by_parent by_parent.keys.sort.each do |parent_key| puts "#{parent_key}:" by_parent[parent_key].each do |url, clazz| puts " - #{url[parent_key.size+1..-1]} (#{clazz.name})" end end end end end