Class: Pod::Command::Plugins::Search
- Inherits:
-
Pod::Command::Plugins
- Object
- Pod::Command
- Pod::Command::Plugins
- Pod::Command::Plugins::Search
- Defined in:
- lib/pod/command/plugins/search.rb
Overview
The search subcommand. Used to search a plugin in the list of known plugins, searching into the name, author description fields
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(argv) ⇒ Search
constructor
A new instance of Search.
- #run ⇒ Object
- #validate! ⇒ Object
Constructor Details
#initialize(argv) ⇒ Search
Returns a new instance of Search.
29 30 31 32 33 |
# File 'lib/pod/command/plugins/search.rb', line 29 def initialize(argv) @full_text_search = argv.flag?('full') @query = argv.shift_argument unless argv.arguments.empty? super end |
Class Method Details
.options ⇒ Object
23 24 25 26 27 |
# File 'lib/pod/command/plugins/search.rb', line 23 def self. [ ['--full', 'Search by name, author, and description'] ].concat(super.reject { |option, _| option == '--silent' }) end |
Instance Method Details
#run ⇒ Object
45 46 47 48 49 50 51 52 |
# File 'lib/pod/command/plugins/search.rb', line 45 def run plugins = PluginsHelper.matching_plugins(@query, @full_text_search) UI.title "Available CocoaPods Plugins matching '#{@query}':" plugins.each do |plugin| PluginsHelper.print_plugin plugin, self.verbose? end end |
#validate! ⇒ Object
35 36 37 38 39 40 41 42 43 |
# File 'lib/pod/command/plugins/search.rb', line 35 def validate! super help! 'A search query is required.' if @query.nil? || @query.empty? begin /#{@query}/ rescue RegexpError help! 'A valid regular expression is required.' end end |