Module: GhSearch

Defined in:
lib/gh_search/github_client.rb,
lib/gh_search.rb,
lib/gh_search/cli.rb,
lib/gh_search/version.rb,
lib/gh_search/formatters.rb,
lib/gh_search/formatters/csv.rb,
lib/gh_search/formatters/base.rb,
lib/gh_search/formatters/json.rb,
lib/gh_search/formatters/plain.rb

Overview

Simple utilitiy that uses the GitHub API for search

Example endpoint it uses: https://api.github.com/search/code?q=HACK+in:file+org:Sage

Defined Under Namespace

Modules: Formatters Classes: CLI, Error, GithubClient

Constant Summary collapse

VERSION =
"0.1.0"

Class Method Summary collapse

Class Method Details

.run(search_text, options = {}) ⇒ Object



8
9
10
11
12
13
14
15
16
# File 'lib/gh_search.rb', line 8

def self.run(search_text, options={})
  client = GithubClient.new(search_text, options)

  Formatters.with(options.fetch(:format, 'plain')) do |formatter|
    client.each do |match|
      formatter.write(match)
    end
  end
end