# File lib/rubygems/uninstaller.rb, line 71
  def uninstall
    list = @source_index.find_name @gem, @version
    list += @user_index.find_name @gem, @version if @user_install

    if list.empty? then
      raise Gem::InstallError, "cannot uninstall, check `gem list -d #{@gem}`"

    elsif list.size > 1 and @force_all then
      remove_all list.dup

    elsif list.size > 1 then
      gem_names = list.collect {|gem| gem.full_name} + ["All versions"]

      say
      gem_name, index = choose_from_list "Select gem to uninstall:", gem_names

      if index == list.size then
        remove_all list.dup
      elsif index >= 0 && index < list.size then
        uninstall_gem list[index], list.dup
      else
        say "Error: must enter a number [1-#{list.size+1}]"
      end
    else
      uninstall_gem list.first, list.dup
    end
  end