Code Monkey home page Code Monkey logo

src-cli's Introduction

src is a command line interface to Sourcegraph:

  • Search & get results in your terminal
  • Search & get JSON for programmatic consumption
  • Make GraphQL API requests with auth easily & get JSON back fast
  • Execute campaign actions
  • Manage & administrate repositories, users, and more
  • Easily convert src-CLI commands to equivalent curl commands, just add --get-curl!

Note: Using Sourcegraph 3.12 or earlier? See the older README.

Installation

Binary downloads are available on the releases tab, and through Sourcegraph.com. If the latest version does not work for you, consider using the version compatible with your Sourcegraph instance instead.

Installation: Mac OS

Latest version

curl -L https://sourcegraph.com/.api/src-cli/src_darwin_amd64 -o /usr/local/bin/src
chmod +x /usr/local/bin/src

or

brew install sourcegraph/src-cli/src-cli

Version compatible with your Sourcegraph instance

Replace sourcegraph.example.com with your Sourcegraph instance URL:

curl -L https://sourcegraph.example.com/.api/src-cli/src_darwin_amd64 -o /usr/local/bin/src
chmod +x /usr/local/bin/src

Installation: Linux

Latest version

curl -L https://sourcegraph.com/.api/src-cli/src_linux_amd64 -o /usr/local/bin/src
chmod +x /usr/local/bin/src

Version compatible with your Sourcegraph instance

Replace sourcegraph.example.com with your Sourcegraph instance URL:

curl -L https://sourcegraph.example.com/.api/src-cli/src_linux_amd64 -o /usr/local/bin/src
chmod +x /usr/local/bin/src

Installation: Windows

See Sourcegraph CLI for Windows.

Setup with your Sourcegraph instance

Via environment variables

Point src to your instance and access token using environment variables:

SRC_ENDPOINT=https://sourcegraph.example.com SRC_ACCESS_TOKEN="secret" src search 'foobar'

Sourcegraph behind a custom auth proxy? See auth proxy configuration docs.

Where to get an access token

Visit your Sourcegraph instance (or https://sourcegraph.com), click your username in the top right to open the user menu, select Settings, and then select Access tokens in the left hand menu.

Usage

src provides different subcommands to interact with different parts of Sourcegraph:

  • src search - perform searches and get results in your terminal or as JSON
  • src actions - run campaign actions to generate patch sets
  • src api - run Sourcegraph GraphQL API requests
  • src campaigns - manages campaigns
  • src repos - manage repositories
  • src users - manage users
  • src orgs - manages organization
  • src config - manage global, org, and user settings
  • src extsvc - manage external services (repository configuration)
  • src extensions - manage extensions
  • src lsif - manages LSIF data
  • src serve-git - serves your local git repositories over HTTP for Sourcegraph to pull
  • src version - check version and guaranteed-compatible version for your Sourcegraph instance

Run src -h and src <subcommand> -h for more detailed usage information.

Optional: Renaming src

If you have a naming conflict with the src command, such as a Bash alias, you can rename the static binary. For example, on Linux / Mac OS:

mv /usr/local/bin/src /usr/local/bin/src-cli

You can then invoke it via src-cli.

src-cli's People

Contributors

asdine avatar attfarhan avatar bobheadxi avatar boyan-soubachov avatar chrismwendt avatar efritz avatar eseliger avatar felixfbecker avatar gbrik avatar ggilmore avatar keegancsmith avatar kevinzliu avatar kzh avatar lawngnome avatar lukeautry avatar mdaniel avatar mrnugget avatar renovate[bot] avatar rvantonder avatar ryanslade avatar slimsag avatar sourcegraph-bot avatar sqs avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.