2016-02-01 12:43:26 +00:00
|
|
|
# frozen_string_literal: true
|
2007-11-10 07:48:56 +00:00
|
|
|
require 'rubygems/command'
|
|
|
|
require 'rubygems/commands/query_command'
|
|
|
|
|
2008-06-17 22:04:18 +00:00
|
|
|
##
|
|
|
|
# An alternate to Gem::Commands::QueryCommand that searches for gems starting
|
2015-12-11 02:53:09 +00:00
|
|
|
# with the supplied argument.
|
2008-06-17 22:04:18 +00:00
|
|
|
|
|
|
|
class Gem::Commands::ListCommand < Gem::Commands::QueryCommand
|
|
|
|
|
2013-07-08 22:41:03 +00:00
|
|
|
def initialize
|
2014-09-14 03:30:02 +00:00
|
|
|
super 'list', 'Display local gems whose name matches REGEXP'
|
2008-06-17 22:04:18 +00:00
|
|
|
|
|
|
|
remove_option('--name-matches')
|
|
|
|
end
|
|
|
|
|
|
|
|
def arguments # :nodoc:
|
2014-09-14 03:30:02 +00:00
|
|
|
"REGEXP regexp to look for in gem name"
|
2008-06-17 22:04:18 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def defaults_str # :nodoc:
|
|
|
|
"--local --no-details"
|
2007-11-10 07:48:56 +00:00
|
|
|
end
|
2008-06-17 22:04:18 +00:00
|
|
|
|
2013-09-14 08:59:02 +00:00
|
|
|
def description # :nodoc:
|
|
|
|
<<-EOF
|
|
|
|
The list command is used to view the gems you have installed locally.
|
|
|
|
|
|
|
|
The --details option displays additional details including the summary, the
|
|
|
|
homepage, the author, the locations of different versions of the gem.
|
|
|
|
|
|
|
|
To search for remote gems use the search command.
|
|
|
|
EOF
|
|
|
|
end
|
|
|
|
|
2008-06-17 22:04:18 +00:00
|
|
|
def usage # :nodoc:
|
2015-07-01 21:50:14 +00:00
|
|
|
"#{program_name} [REGEXP ...]"
|
2008-06-17 22:04:18 +00:00
|
|
|
end
|
|
|
|
|
2007-11-10 07:48:56 +00:00
|
|
|
end
|