Interact with Sourcegraph from the command line faster with Fig

Justin Dorfman

We are really excited to announce our latest integration with Fig! For those of you who don’t know about Fig, it is a tool that adds IDE-style autocomplete to your existing terminal (currently on macOS.)

When I was onboarding at Sourcegraph one of my todos was to install and learn how to use src, a command-line interface to Sourcegraph. The installation was straightforward, but I couldn’t remember all of the different subcommands so I found myself typing src --help and hitting the up arrow a lot.

Then I remembered Zeno Rocha tweeting about Fig and I thought this might be a good opportunity to write an integration. After demoing the proof of concept to my team I got a lot of great feedback and decided to make a pull request to Fig on GitHub.

Let’s see this in action!

I’m in the process of creating a budget for sponsoring the dependencies that Sourcegraph uses via Open Collective. Here is a real-world example of how I accomplish that.

Want to try it out?

We got you covered. Install src (no login required):

# via Curl
curl -L https://sourcegraph.com/.api/src-cli/src_darwin_amd64 -o /usr/local/bin/src
chmod +x /usr/local/bin/src
 
# via Brew
brew install sourcegraph/src-cli/src-cli

Next, download Fig and open/restart your terminal.

Then type src and you should see an IDE-style autocomplete with subcommands and options.

Let us know what you think on Twitter or our Community Slack.

Last but not least, a huge thanks to the Fig team ◧ especially Federico Ciardi for their help. We look forward to working together again!


Thanks to the following people for helping with this post: Rebecca Dodd, Eric Fritz, and Stephen Gutekanst.

About the author

Justin Dorfman is Sourcegraph’s Open Source Program Manager and is responsible for fostering the adoption of code intelligence in the open source community. You can chat with Justin on Twitter @jdorfman or our community Discord

Get Cody, the AI coding assistant

Cody makes it easy to write, fix, and maintain code.