lib/neetob/cli/github/search.rb in neetob-0.2.2 vs lib/neetob/cli/github/search.rb in neetob-0.2.3

- old
+ new

@@ -4,25 +4,25 @@ module Neetob class CLI module Github class Search < Base - attr_accessor :apps, :key_to_search, :search_file_path, :sandbox + attr_accessor :repos, :key_to_search, :search_file_path, :sandbox - def initialize(apps, key_to_search, search_file_path, sandbox = false) + def initialize(repos, key_to_search, search_file_path, sandbox = false) super() - @apps = apps + @repos = repos @key_to_search = key_to_search @search_file_path = search_file_path @sandbox = sandbox end def run - matching_apps = find_all_matching_apps(apps, :github, sandbox) - matching_apps.each do |app| + matching_repos = find_all_matching_apps_or_repos(repos, :github, sandbox) + matching_repos.each do |repo| begin - ui.info("\n Searching in \"#{app}/#{search_file_path}\" for \"#{key_to_search}\"\n") - content = Base64.decode64(client.contents(app, path: search_file_path).content) + ui.info("\n Searching in \"#{repo}/#{search_file_path}\" for \"#{key_to_search}\"\n") + content = Base64.decode64(client.contents(repo, path: search_file_path).content) ui.error("Keyword not found") and next unless content.include? key_to_search content.each_line do |line| ui.success(line) if line.include?(key_to_search) end