Sha256: 82610d446d57736b3c2d3a8c81fee3edcf5c666133754ace90176a72404d9178
Contents?: true
Size: 1.05 KB
Versions: 6
Compression:
Stored size: 1.05 KB
Contents
# frozen_string_literal: true require 'command_kit/command' require 'command_kit/commands/parent_command' module CommandKit module Commands # # The default help command. # # @api semipublic # class Help < Command include ParentCommand argument :command, required: false, desc: 'Command name to lookup' # # Prints the given commands `--help` output or lists registered commands. # # @param [String, nil] command # The given command name, or `nil` if no command name was given. # def run(command=nil) case command when nil parent_command.help else if (subcommand = parent_command.command(command)) unless subcommand.respond_to?(:help) raise(TypeError,"#{subcommand.inspect} must define a #help method") end subcommand.help else print_error "unknown command: #{command}" exit(1) end end end end end end
Version data entries
6 entries across 6 versions & 1 rubygems