Skip to content

Commit

Permalink
Merge pull request #3540 from rolandwalker/respect_digits_in_search
Browse files Browse the repository at this point in the history
respect digits in search strings
  • Loading branch information
rolandwalker committed Mar 15, 2014
2 parents c6ea492 + e8bd346 commit f15c253
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/cask/cli/search.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ def self.search(*arguments)
else
# suppressing search of the font Tap is a quick hack until behavior can be made configurable
all_titles = Cask::CLI.nice_listing Cask.all_titles.reject{ |t| %r{^caskroom-fonts/}.match(t)}
simplified_titles = all_titles.map { |t| t.gsub(/[^a-z]+/i, '') }
simplified_search_term = search_term.sub(/\.rb$/i,'').gsub(/[^a-z]+/i, '')
simplified_titles = all_titles.map { |t| t.gsub(/[^a-z0-9]+/i, '') }
simplified_search_term = search_term.sub(/\.rb$/i,'').gsub(/[^a-z0-9]+/i, '')
exact_match = simplified_titles.grep(/^#{simplified_search_term}$/i) { |t| all_titles[simplified_titles.index(t)] }.first
partial_matches = simplified_titles.grep(/#{simplified_search_term}/i) { |t| all_titles[simplified_titles.index(t)] }
partial_matches.delete(exact_match)
Expand Down

0 comments on commit f15c253

Please sign in to comment.