Class: Grepfruit::Commands::Search

Inherits:
Dry::CLI::Command
  • Object
show all
Defined in:
lib/grepfruit/cli.rb

Instance Method Summary collapse

Instance Method Details

#call(path: ".", **options) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/grepfruit/cli.rb', line 20

def call(path: ".", **options)
  validate_options!(options)

  Grepfruit::Search.new(
    dir: path,
    regex: create_regex(options[:regex]),
    exclude: options[:exclude] || [],
    include: options[:include] || [],
    truncate: options[:truncate]&.to_i,
    search_hidden: options[:search_hidden],
    jobs: options[:jobs]&.to_i,
    json_output: options[:json]
  ).run
end