Sha256: 5f91b5eba33b69c8722ef71ab6c6673a55703a716f7f35c76f3b3abe191b22b6
Contents?: true
Size: 641 Bytes
Versions: 17
Compression:
Stored size: 641 Bytes
Contents
class Cl class Help < Cl::Cmd register :help def run ctx.puts help end def help args.any? ? Cmd.new(ctx, cmd).format : Cmds.new(ctx, cmds).format end private 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 def cmd key = args.join(':') return Cl::Cmd[key] if Cl::Cmd.registered?(key) ctx.abort("Unknown command: #{key}") end end end require 'cl/help/cmd' require 'cl/help/cmds'
Version data entries
17 entries across 17 versions & 1 rubygems