tgvashworth

Notes on building CLI applications in Rust

22 Jan 2018

My team maintains a number of increasingly complex CLI tools, mostly written in Bash, though some is Scala in order to share code with other applications.

We’re looking at migrating these to a more testable, modern language.

Python is the de-facto language for this at Twitter, but I also wanted to explore how Rust would fit the bill. These are my notes.

Requirements

What are we already doing with Bash?

Crates

These crates might be useful:

I got lots of this from @vitiral’s great Rust2018 And The Great Cli Awakening post.

Rust has work-in-progress support for Thrift but this may not be compatible with scrooge. Perhaps Scrooge could be extended to provide Rust support. Thrift support isn’t a hard requirement yet.

We won’t actually be pushing Rust too hard: mostly the existing tools wrangle paths and shell out to other executables. For the most part, the code will be very imperative and will handle errors & exit immediately.

Pants currently has no support for rust although parts of its core are being rewritten in the language. There is appetite at Twitter for using Rust, but only a small community who already have experience.

The biggest con of the idea is requiring the GraphQL team to learn Rust when there is Python within the team already, and the risk of reverting this decision in the future as the team changes or if Rust moves to a negative standing on our tech radar.