Sha256: 3b6899df5179b2d50d7a6d049f8215669e039b429c614a0e3e58f15b6de21794
Contents?: true
Size: 1.14 KB
Versions: 4
Compression:
Stored size: 1.14 KB
Contents
# Copyright (C) 2011, 2015 Rocky Bernstein <rockyb@rubyforge.net> require_relative '../command' require_relative '../load_cmds' class Trepan::Command::CompleteCommand < Trepan::Command unless defined?(HELP) NAME = File.basename(__FILE__, '.rb') HELP = <<-HELP **#{NAME}** *command-prefix* List the completions for the rest of the line as a command. This is a gdb command. One use is an a front-end which supports completion. GNU Emacs for example has been known to use this. HELP CATEGORY = 'support' NEED_STACK = false SHORT_HELP = 'List the completions for the rest of the line as a command' end # This method runs the command def run(args) # :nodoc last_arg = @proc.cmd_argstr.end_with?(' ') ? '' : args[-1] @proc.complete(@proc.cmd_argstr, last_arg).each do |match| msg match end end end if __FILE__ == $0 # Demo it. require_relative '../mock' dbgr, cmd = MockDebugger::setup %w(d b bt).each do |prefix| cmd.proc.instance_variable_set('@cmd_argstr', prefix) cmd.run [cmd.name, prefix] puts '=' * 40 end cmd.run %w(#{cmd.name} fdafsasfda) puts '=' * 40 end
Version data entries
4 entries across 4 versions & 1 rubygems