Sha256: 883eecd8046b3e8304e84c20b8a1e04a9bf1c3f4eda12ed074c6a18037fe6dfb

Contents?: true

Size: 1.5 KB

Versions: 4

Compression:

Stored size: 1.5 KB

Contents

# -*- coding: utf-8 -*-
# Copyright (C) 2010-2011, 2015 Rocky Bernstein <rockyb@rubyforge.net>
require_relative '../base/subcmd'

class Trepan::Subcommand::ReloadCommand < Trepan::Subcommand
  unless defined?(HELP)
    Trepanning::Subcommand.set_name_prefix(__FILE__, self)
    HELP = <<-HELP
**#{PREFIX.join(' ')}** [*file-or-directory* ...]

Loads or reloads debugger commands. If no parameters are passed all
commands are reloaded. If a parameters are passed each is expected to
be a either a Ruby file which implements a series of debugger
commands by defining Trepan::Command classes, or a directory which contains
files that implements debugger commands.
    HELP
    MIN_ABBREV   = 'co'.size # Note we have "info file"
    NEED_STACK   = true
    SHORT_HELP   = 'Reload debugger commmands from debugger directories'
  end

  def run(args)
    if args.size == 2
      @proc.load_cmds_initialize
      msg('Debugger commands reloaded.')
    elsif args.size > 2
      args[2..-1].each do |name|
        if @proc.load_debugger_commands(name)
          msg "Debugger command file #{name} loaded."
        else
          errmsg "Can't load file or directory #{name}"
        end
      end
    end
  end

end

if __FILE__ == $0
  # Demo it.
  require_relative '../../mock'
  cmd = MockDebugger::sub_setup(Trepan::Subcommand::ReloadCommand, false)
  cmd.run(cmd.prefix)
  dir = File.dirname(__FILE__)
  cmd.run(cmd.prefix + [File.join(%W(#{dir} .. list.rb))])
  cmd.run(cmd.prefix + [File.join(%W(#{dir} nonexistent-command.rb))])
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
trepanning-2.15.35 processor/command/reload_subcmd/command.rb
trepanning-1.93.35 processor/command/reload_subcmd/command.rb
trepanning-2.15.33 processor/command/reload_subcmd/command.rb
trepanning-1.93.32 processor/command/reload_subcmd/command.rb