Lately I got interested in Rust, it sounds fun and hacky, and a lot of cool people use it. Here is me build some CLI applications in Rust because.. CLI application are fun?
Why Rust? It's a strongly typed programming language. What’s up with it? NPM use it. There is an interesting HackerNews article about it that explains why they use it at npm. It came up often recently in my tech browsing so I want to give it a try.
Rust has a suprisingly nice and eye-pleasing website, so I can't wait to follow their CLI tutorial. Wait, there is even a "Getting Started book"? This is seriously cool, I am gonna do that. Please follow me.
>>> First look at "Command line apps in Rust"
First thing, this book doesn't joke in terms of UI, it seriously polished and I don't thing I ever saw it before. There is no "build with" at the bottom on the page and from the Github Repo I can't immediately tell what they used to build it. I will come back later on this.
It really reminds of C, especially after I encounter the & operator. On the other hand, there is this awesome property that 'As [Rust] doesn’t have exceptions, all possible error states are often encoded in the return types of functions.' Coming from Python that really sounds attractive.
>>> Setting myself up for Rust
Rust is looking nice, I decide to get the rust.vim configuration for my vim. I added it to my personal vimrc setting. You can use :RustFmt to automatically format your rust code, and you can use a combination of :make build + :copen the get the build errors and open them in quickfix. Having a look at the basic Rust packages, I pretty much liked indicatif for CLI animations: makes your CLI look neat (here is my Rust progress bar). On a side note, the creator of indicatif is Armin Ronacher, the same guy from Flask! Turns out he is a Rust fun, and wrote some nice blog post of him building a HTTP cli in Rust.
This is what I built so far, I plan to keep following the Rust book to build some more, drop me a line at email@example.com if you read until here!