Class: Grepfruit::CliSearch
- Includes:
- CliDecorator
- Defined in:
- lib/grepfruit/cli_search.rb
Constant Summary
Constants included from CliDecorator
Grepfruit::CliDecorator::COLORS
Instance Attribute Summary
Attributes inherited from Search
#count, #excluded_lines, #excluded_paths, #exclusions, #inclusions, #jobs, #json, #path, #regex, #search_hidden, #truncate
Instance Method Summary collapse
Methods inherited from Search
Constructor Details
This class inherits a constructor from Grepfruit::Search
Instance Method Details
#execute ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/grepfruit/cli_search.rb', line 7 def execute puts "Error: Path '#{path}' does not exist." and exit 1 unless File.exist?(path) unless json puts "Searching for #{regex.inspect} in #{path.inspect}..." puts end results = execute_search if json display_json_results(build_result_hash(results)) else display_results(results) end exit(results.match_count.positive? ? 1 : 0) end |