lib/arli/commands/search.rb in arli-1.0.2 vs lib/arli/commands/search.rb in arli-1.1.0

- old
+ new

@@ -23,16 +23,20 @@ :format, :unique_libraries def initialize(*args) super(*args) - self.format = config.search.results.output_format + self.format = config.search.results.output_format valid_methods = Arli::Library::MultiVersion.format_methods raise Arli::Errors::InvalidSearchSyntaxError, "invalid format #{format}" unless valid_methods.include?(format) end + def additional_info + "\nSearching For: #{runtime.argv.join(' ').bold.green}\n" + end + def run self.search_opts = process_search_options! self.results = search(database, **search_opts).sort self.unique_libraries = Set.new @@ -110,29 +114,34 @@ end def handle_and_raise_error(e) message = e.message if message =~ /undefined method.*Arduino::Library::Model/ - message = "Invalid attributed search. Possible values are:" + + message = 'Invalid attributed search. Possible values are:' + "\n#{Arduino::Library::Types::LIBRARY_PROPERTIES.keys}" end raise Arli::Errors::InvalidSearchSyntaxError, "Search string '#{search_string}' is invalid.\n" + message.red end def print_total_with_help - puts "———————————————————————" + hr_short puts " Total Versions : #{results.size.to_s.bold.magenta}\n" puts "Unique Libraries : #{unique_libraries.size.to_s.bold.magenta}\n" - puts "———————————————————————" + hr_short if results.size == Arli::Configuration::DEFAULT_RESULTS_LIMIT puts "Hint: use #{'-m 5'.bold.green} to limit the result set." end end def params search_opts + end + + private + def hr_short + puts '———————————————————————' end end end end