Sha256: 382ca3f11ea39420c5d62528fa642e43a00b947e7abed72d1d05d0bffe71d42c

Contents?: true

Size: 908 Bytes

Versions: 7

Compression:

Stored size: 908 Bytes

Contents

# Copyright (C) 2010 Rocky Bernstein <rockyb@rubyforge.net>
require_relative 'base/cmd'

class Trepan::Command::UnaliasCommand < Trepan::Command

  unless defined?(HELP)
    HELP = 
"unalias COMMAND

Remove alias for COMMAND

See also 'alias'.
"

    CATEGORY      = 'support'
    MIN_ARGS      = 1
    # MAX_ARGS      = 1  # Need at most this many
    NAME          = File.basename(__FILE__, '.rb')
    NEED_STACK    = true
    SHORT_HELP    = 'Remove an alias'
  end
  
  # Run command. 
  def run(args)
    args[1..-1].each do |arg|
      if @proc.aliases.member?(arg)
        @proc.aliases.delete(arg)
        msg "Alias for #{arg} removed."
      else
        msg "No alias found for #{arg}."
      end
    end
  end
end

if __FILE__ == $0
  # Demo it.
  require_relative '../mock'
  dbgr, cmd = MockDebugger::setup
  cmd.run %W(cmd.name s)
  cmd.run %W(cmd.name s)
  cmd.run %W(cmd.name foo bar n)
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
trepanning-0.1.3 processor/command/unalias.rb
trepanning-0.1.2 processor/command/unalias.rb
trepanning-0.1.1 processor/command/unalias.rb
trepanning-0.1.0 processor/command/unalias.rb
trepanning-0.0.9 processor/command/unalias.rb
trepanning-0.0.8 processor/command/unalias.rb
trepanning-0.0.6 processor/command/unalias.rb