class Byebug::SourceCommand

Implements byebug “source” command.

def description

def description
  %{source FILE\texecutes a file containing byebug commands}
end

def execute

def execute
  return print SourceCommand.help(nil) if
    SourceCommand.names.include?(@match[0])
  file = File.expand_path(@match[1]).strip
  return errmsg "File \"#{file}\" not found\n" unless File.exist?(file)
  if @state and @state.interface
    @state.interface.command_queue += File.open(file).readlines
  else
    Byebug.run_script(file, @state)
  end
end

def names

def names
  %w(source)
end

def regexp

def regexp
  /^\s* so(?:urce)? (?:\s+(\S+))? \s*$/x
end