Commit 55117eb3 authored by Kyle Fuller's avatar Kyle Fuller

Search: Present a user friendly message with invalid regex

Fixes #1821
parent e42d5f6e
...@@ -13,6 +13,10 @@ To install or update CocoaPods see this [guide](http://docs.cocoapods.org/guides ...@@ -13,6 +13,10 @@ To install or update CocoaPods see this [guide](http://docs.cocoapods.org/guides
[Jeff Verkoeyen](https://github.com/jverkoey) [Jeff Verkoeyen](https://github.com/jverkoey)
[#1803](https://github.com/CocoaPods/CocoaPods/pull/1803) [#1803](https://github.com/CocoaPods/CocoaPods/pull/1803)
* Improves the error message when searching with an invalid regular expression.
[Kyle Fuller](https://github.com/kylef)
## 0.29.0 ## 0.29.0
[CocoaPods](https://github.com/CocoaPods/CocoaPods/compare/0.28.0...0.29.0) [CocoaPods](https://github.com/CocoaPods/CocoaPods/compare/0.28.0...0.29.0)
[CocoaPods-core](https://github.com/CocoaPods/Core/compare/0.28.0...0.29.0) [CocoaPods-core](https://github.com/CocoaPods/Core/compare/0.28.0...0.29.0)
......
...@@ -35,6 +35,10 @@ module Pod ...@@ -35,6 +35,10 @@ module Pod
def validate! def validate!
super super
help! "A search query is required." unless @query help! "A search query is required." unless @query
/#{@query.join(' ').strip}/
rescue RegexpError
help! "A valid regular expression is required."
end end
def run def run
......
...@@ -49,7 +49,11 @@ module Pod ...@@ -49,7 +49,11 @@ module Pod
output = run_command('search', 'BananaLib', '--silent') output = run_command('search', 'BananaLib', '--silent')
output.should.include? 'BananaLib' output.should.include? 'BananaLib'
end end
it "shows a friendly message when searching with invalid regex" do
lambda { run_command('search', '+') }.should.raise CLAide::Help
end
describe "option --web" do describe "option --web" do
extend SpecHelper::TemporaryRepos extend SpecHelper::TemporaryRepos
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment