beyang / sgbl

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

sgbl

A lightweight cli tool to interact with Sourcegraph.

Installation

go get github.com/beyang/sgbl

Configuration

You can configure sgbl to work with private Sourcegraph instances in addition to Sourcegraph.com.

To do this, save a JSON file like the following to ~/.sgbl-config:

{
  "sourcegraphs": [
    {
      "url": "https://sourcegraph.mycompany.com",
      "repos": [
          "github.com/mycompany/private-repo",
          ...
       ]
    },
    ...
  ]
}

Usage

sgbl [options] path/to/file

Examples

Open a local file

sgbl main.go

Open a local file at a certain position

sgbl --line=22 main.go
# or
sgbl --line=22 --col=6 main.go
# or
sgbl --pos=22:6 main.go

Execute a search

sgbl --search="repo:gorilla/mux ^func Test"

Execute a search over the current repo

sgbl --search="^func main" .

About


Languages

Language:Go 100.0%