Lesser Known Tools We Love at Kiwi.com, Part 1 of 3: CLI

Nagy Bence
code.kiwi.com
Published in
5 min readNov 24, 2016

We’re all trying to save the time we spend on repetitive tasks, but as xkcd illustrates, often it’s just not worth wasting your time seeking out new tools and ways to be more productive. We developers at Kiwi.com thought it would be nice to share an easily digestible, no-nonsense, rapid-fire list of tools that make our everyday work better and easier — so, here we go!

The silver searcher (ag)

The silver searcher is a tool for blazing fast code search. Just run ag fooand it will instantly find you all the occurrences of foo in the current directory. Not only is ag super optimised for searching, it’s also really smart about ignoring unneeded files—unlike grep foo -r ., ag will not look through your .git directory and all your dependencies, saving tons of effort. Couple this with the fact that ag has an awesome interface, with a beautiful, coloured output and intuitive flags (such as--python to filter Python files only), and we’ve got ourselves the best possible method of searching code.

Notable alternatives: ripgrep and ack

fasd

fasd is a surprisingly small script that hooks into your shell to learn your most ‘frecently’ used files and directories. Just let it warm up for a bit and you’ll be able to type z proj to switch to the /home/me/needlessly/long/and/windy/path/to/some-project directory, or mv HelloWorld.java `d trash` to save the trouble of finding out where your trash directory is. For those of you wondering, ‘frecently’ means that it uses a combination of frequency and recency of access to guess which path you mean.

coala

coala makes extensive code analysis really easy to set up and use. It hooks into nearly a hundred existing linters (and has some of its own too), giving them all a unified interface — including the configuration in most cases. Not only is it neat to have one program to handle all the checking, but it also encourages more disciplined behaviour; for instance you wouldn’t normally go out of your way to set up syntax checking for YAML files, but if it’s as simple as asking coala to check them, why wouldn’t you?

Even better though, coala is also very easily extensible: Write a few lines of code to check for problems that you’re worried about with regular expressions or something, and you get file collection, ignore comment support, a user friendly interface and tons of other features for free!

coala suggesting a patch to fix a URL in my script

HTTPie

HTTPie is a lovely HTTP client. Most people are probably used to working with curl when making HTTP requests. Can you think of how you could follow the redirects of a POST request to http://kiwi.com and download the resulting file with curl? It’s

curl http://kiwi.com --request POST --output en.html --location

…and if you actually knew this, that’s kind of a problem. You shouldn’t have to remember all these arcane names for the arguments (even though there’s probably a good reason for them). With HTTPie, it’s as simple and intuitive as

http POST http://kiwi.com --follow --download
HTTPie also does prettifying and syntax highlighting by default!

jq

jq is what you need if you’re ready to take JSON parsing to the next level after HTTPie’s formatting and colouring. When calling jq on its own, you get the exact same beautifying, but the magic is that it also allows you to query your JSON object. It has a pretty powerful query language that supports not just JSON traversal, but also string and math operations, ‘group by’, and so on.

jq parsing the GitHub API response and generating git clone commands for all python repos

Alright, now it’s time for some really small, single purpose utilities.

fast-cli

fast-cli will tell you how fast your internet connection is. That’s it!

fast-cli revelling in one tenth of our badass gigabit line

joe

joe generates .gitignore files for you. Pretty handy if you’re starting new projects often—and it has a cool name, if you think about it for a bit.

joe telling me which files to ignore

colordiff

colordiff is exactly what the name would suggest. It’s just a version of diff with a coloured output. Makes you wonder why diff doesn’t already support this.

With the help of colordiff I can finally see the difference! (I don’t have very good eyesight)

tldr

tldr will give you example usages of commands to save you the trouble of hopelessly trying to look for help in man pages.

tldr on how to use the silver searcher—quite meta, isn’t it?

Notable alternatives: bro and cheat

powerline

powerline is what’s responsible for the slick shell prompt you see in the screenshots above, in case you were wondering. It’s customisable, and you can get it to display your current git branch, number of git stashes in the current repo, battery level… and pretty much everything. A big favourite is the exit status display for each part of a command pipeline. Oh, and it’s not limited to your shell—it can also display info in vim, tmux, and ipython!

powerline shows you when part of a command pipeline is failing

That’s it for the first part of our series on tools! If you’re feeling very adventurous, you can get all of the above by running:

brew install ag fasd jq colordiff
brew install python3 node yarn
pip3 install coala-bears httpie joe powerline-status
yarn global add fast-cli tldr

And of course, keep an eye on code.kiwi.com if you’re interested in our favourite Mac/web apps in part 2 of this series, or our favourite Python libraries in part 3!

--

--