lib/byebug/commands/enable.rb in byebug-1.1.0 vs lib/byebug/commands/enable.rb in byebug-1.1.1

- old
+ new

@@ -40,11 +40,10 @@ pos = get_int(pos, "#{is_enable} display", 1, @state.display.size) return nil unless pos @state.display[pos-1][0] = ('Enable' == is_enable) end end - end class EnableCommand < Command Subcommands = [ @@ -86,32 +85,31 @@ def enable_display(args) enable_disable_display('Enable', args) end + def help + if args[1] + subcmd = find(Subcommands, args[1]) + return "Invalid \"enable\" subcommand \"#{args[1]}\"." unless subcmd + str = subcmd.short_help + '.' + str += '\n' + subcmd.long_help if subcmd.long_help + return str + end + EnableCommand.description + format_subcmds(Subcommands) + end + class << self - def help_command - 'enable' + def names + %w(enable) end - def help(args) - # specific subcommand help - if args[1] - subcmd = find(Subcommands, args[1]) - return "Invalid \"enable\" subcommand \"#{args[1]}\"." unless subcmd - - str = subcmd.short_help + '.' - str += '\n' + subcmd.long_help if subcmd.long_help - return str - end - - # general help - str = %{ + def description + %{ Enable some things. This is used to cancel the effect of the "disable" command. } - str += format_subcmds(Subcommands) end end end class DisableCommand < Command @@ -154,34 +152,34 @@ def disable_display(args) enable_disable_display('Disable', args) end + def help(args) + if args[1] + subcmd = find(Subcommands, args[1]) + return "Invalid \"disable\" subcommand \"#{args[1]}\"." unless subcmd + + str = subcmd.short_help + '.' + str += '\n' + subcmd.long_help if subcmd.long_help + return str + end + DisableCommand.description + format_subcmds(Subcommads) + end + class << self - def help_command - 'disable' + def names + %w(disable) end - def help(args) - # specific subcommand help - if args[1] - subcmd = find(Subcommands, args[1]) - return "Invalid \"disable\" subcommand \"#{args[1]}\"." unless subcmd - - str = subcmd.short_help + '.' - str += '\n' + subcmd.long_help if subcmd.long_help - return str - end - - # general help - str = %{ + def description + %{ Disable some things. A disabled item is not forgotten, but has no effect until reenabled. Use the "enable" command to have it take effect again. - } - str += format_subcmds(Subcommads) + } end end end -end # module Byebug +end