Sha256: 5cba08a995e667064d598d198cb059a86d43e6a05879b6cc19aff997ac44a3c1
Contents?: true
Size: 1.05 KB
Versions: 16
Compression:
Stored size: 1.05 KB
Contents
require 'forwardable' require 'byebug/helpers/reflection' require 'byebug/command_list' module Byebug # # Subcommand additions. # module Subcommands def self.included(command) command.extend(ClassMethods) end extend Forwardable def_delegators :'self.class', :subcommand_list # # Delegates to subcommands or prints help if no subcommand specified. # def execute subcmd_name = @match[1] return puts(help) unless subcmd_name subcmd = subcommand_list.match(subcmd_name) raise CommandNotFound.new(subcmd_name, self.class) unless subcmd subcmd.new(processor, arguments).execute end # # Class methods added to subcommands # module ClassMethods include Helpers::ReflectionHelper # # Default help text for a command with subcommands # def help super + subcommand_list.to_s end # # Command's subcommands. # def subcommand_list @subcommand_list ||= CommandList.new(commands) end end end end
Version data entries
16 entries across 15 versions & 3 rubygems