class Cl::Help

Public Instance Methods

help() click to toggle source
# File lib/cl/help.rb, line 11
def help
  Array(args).any? ? Cmd.new(ctx, cmd).format : Cmds.new(ctx, cmds).format
end
help?() click to toggle source
# File lib/cl/help.rb, line 15
def help?
  true
end
run() click to toggle source
# File lib/cl/help.rb, line 7
def run
  ctx.puts help
end

Private Instance Methods

cmd() click to toggle source
# File lib/cl/help.rb, line 28
def cmd
  key = args.join(':')
  return Cl::Cmd[key] if Cl::Cmd.registered?(key)
  ctx.abort("Unknown command: #{key}")
end
cmds() click to toggle source
# File lib/cl/help.rb, line 21
def cmds
  cmds = Cl::Cmd.cmds.reject { |cmd| cmd.registry_key == :help }
  key  = args.join(':') if args
  cmds = cmds.select { |cmd| cmd.registry_key.to_s.start_with?(key) } if key
  cmds
end