Rewriting my over-engineered CLI in Rust: Motivation
This is Part 1 in Building a CLI in Rust Series
I like to experiment with new languages and frameworks. But I am pretty bad at finding a viable use case as a side project to test them out. It is often advised that the best thing to work on is to figure out the problems in your workflow and devise a solution. Nowadays, it is to remove any friction from my writing workflow.
I use Obsidian for almost all of my creative note-taking. Any programming-related stuff, exploration, and research goes into the Obsidian. At one point, I also wanted to integrate my writing workflow into Obsidian. It is the place I keep all my “knowledge”. It would be pretty easy to connect the dots in there, right?
Having this workflow is a double-edged sword. Writing in Obsidian is an enjoyable experience, but the side of me that likes to build a system and optimize it took over at some point and wrote a CLI called lazydraft just to easily copy and paste files between my vault and my website content folder.
This tool worked initially. But looking back, I realised I could’ve planned its design much better. First, the API surface I initially created is bloated, and the main functionality is lost among all the non-trivial commands. This is the current command list that It supports:
The second thing is that the tool itself is called lazydraft, but it has an internal draft command to access the actual functionality. That command list is also bloated.
I want to write more on my website and use Obsidian to do it. Removing the friction between my note-taking and publishing medium is a small optimization I could live without now. However, this is an opportunity to hit several birds with one stone.
- I will simplify the API surface of the tool and make it more usable for myself.
- I will rewrite the tool in Rust, a multi-paradigm programming language that I wanted to try for a long time. This project is small enough that I can finish and large enough that I will get my hands dirty to learn the basics of the language.
- I will publish the new version using HomeBrew. Remembering that workflow for future side projects might be a good investment.
- I plan this as a writing series to experiment with this type of content and find my rhythm in writing.
So here we are. This post is the first in Building a CLI in Rust series. In the next post, I plan to focus on research for the Rust version of the tool and come up with a leaner API.