Skip to content

Latest commit

 

History

History
94 lines (65 loc) · 2.19 KB

README.md

File metadata and controls

94 lines (65 loc) · 2.19 KB

repo-zoek

List, download and index github repos for trigram-based search on your machine using zoekt.

Preparation

  • Install node >= 12
  • You need to have golang installed
  • You need a github personal access token and it needs to be accessible in the environment as GITHUB_PAT when running

repo-zoek.

Installation

go install github.com/google/zoekt/cmd/zoekt-index@latest
go install github.com/google/zoekt/cmd/zoekt@latest

# make sure npm does not try to install the script to /usr/local/bin or similar
npm config set prefix ~/.npm-pkg
# (TAKE CARE: if you use nvm or similar,
#  make sure that your prefix setting does
#  not interfere with nvm. In case of nvm, you
#  can probably skip it.)

# install repo-zoek
npm install --global <https://link-to-latest-release.tgz>
# (SEE BELOW for the releases page)

(see release page for newest version)

make sure the go & npm bin path is in your $PATH. You can get the path with

# $GOPATH/bin
go env GOPATH
# npm bin dir
npm bin --global

Example:

export PATH="$(go env GOPATH)/bin:$(npm bin -g):$PATH"

Usage

You need a github personal access token and it needs to be accessible in the environment as GITHUB_PAT when running repo-zoek.

Help:

repo-zoek help

Initial setup of a new "project":

repo-zoek init
repo-zoek org list -d /path/to/project/dir

To download everything:

repo-zoek sync all

Search with

zoekt -r -index_dir path/to/search/index 'regex file:scala'

(I would alias zoekt -r -index_dir path/to/search/index to a more convenient command)

Other stuff you can do with the data

Iterate through the repo list and execute a command

jq -r '.name' </path/to/repos.ndjson  | xargs -IREPO echo "abc REPO def"

TODO

  • look for .repo-zoek.json in the current path
  • handle GITHUB_PAT better?