summaryrefslogtreecommitdiff
path: root/lib/rubygems/commands/query_command.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rubygems/commands/query_command.rb')
-rw-r--r--lib/rubygems/commands/query_command.rb19
1 files changed, 16 insertions, 3 deletions
diff --git a/lib/rubygems/commands/query_command.rb b/lib/rubygems/commands/query_command.rb
index 7dd0a4a0d6..93b417015c 100644
--- a/lib/rubygems/commands/query_command.rb
+++ b/lib/rubygems/commands/query_command.rb
@@ -21,7 +21,7 @@ class Gem::Commands::QueryCommand < Gem::Command
options[:installed] = value
end
- add_version_option
+ add_version_option command, "for use with --installed"
add_option('-n', '--name-matches REGEXP',
'Name of gem(s) to query on matches the',
@@ -185,8 +185,21 @@ class Gem::Commands::QueryCommand < Gem::Command
entry = gem_name.dup
if options[:versions] then
- versions = matching_tuples.map { |(name, version,_),_| version }.uniq
- entry << " (#{versions.join ', '})"
+ list = if platforms.empty? or options[:details] then
+ matching_tuples.map { |(name, version,_),_| version }.uniq
+ else
+ platforms.sort.reverse.map do |version, pls|
+ if pls == [Gem::Platform::RUBY] then
+ version
+ else
+ ruby = pls.delete Gem::Platform::RUBY
+ platform_list = [ruby, *pls.sort].compact
+ "#{version} #{platform_list.join ' '}"
+ end
+ end
+ end.join ', '
+
+ entry << " (#{list})"
end
if options[:details] then