16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/domainr/cli/commands.rb', line 16
def search(query)
client.search(query).results.tap do |results|
available, unavailable = results.map! { |res|
res.suggestion = "#{res.domain.bold}#{res.path.underline}"
res
}.partition { |res| res.availability == 'available' }
available.map! { |res| res.available = '✔'.green; res }
unavailable.map! { |res| res.available = '✗'.red; res }
table available + unavailable,
fields: [:suggestion, :available],
unicode: true
end
end
|