lib/sonar/cli/cli.rb in sonar-client-0.1.1 vs lib/sonar/cli/cli.rb in sonar-client-0.1.2

- old
+ new

@@ -33,16 +33,21 @@ @query[type.to_sym] = term @query[:limit] = options['record_limit'] @query[:exact] = options['exact'] resp = @client.search(@query) + errors = 0 if resp.is_a?(Sonar::Request::RequestIterator) resp.each do |data| + errors += 1 if data.key?('errors') || data.key?('error') print_json(cleanup_data(data), options['format']) end else + errors += 1 if resp.key?('errors') || resp.key?('error') print_json(cleanup_data(resp), options['format']) end + + return errors end desc 'types', 'List all Sonar query types' def types ap Search::QUERY_TYPES_MAP