Class: Namesies::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/namesies/cli.rb

Instance Method Summary collapse

Instance Method Details

#search(q) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/namesies/cli.rb', line 9

def search(q)
  puts "Searching for #{q}..."
  puts "\n"

  services = Namesies.constants - [:VERSION, :CLI, :Reporter]

  if options[:only]
    options[:only].each do |service|
      Namesies.const_get(service.capitalize).send(:search, q)
    end
  else
    services.each do |service|
      next if options[:except] && options[:except].include?(service.to_s.downcase)
      Namesies.const_get(service.capitalize).send(:search, q)
    end
  end

  puts "\n"
end

#servicesObject



30
31
32
33
34
35
# File 'lib/namesies/cli.rb', line 30

def services
  puts "Namesies currently searches:"
  Namesies.constants.each do |service|
    puts "  #{service}" unless [:VERSION, :CLI, :Reporter].include? service
  end
end