Machine Learning
Systems Architect,
PhD Mathematician
soh is a command line tool that I wrote to give simple access to a lot of utility that I found myself googling for regularly. With access to these functions in a common command line interface, one can save time switching contexts to the browser and having to pick up the mouse in general.
It was originally written in python using much of the language’s standard library, and a CLI package called click. I had also released a 3rd party brew tap which enables anyone to install using the brew
package manager.
Since the library is written in python, it has a dependency on python 3 being installed via brew. It also installs all of soh
's dependencies, resulting in a pretty hefty installation process for a simple CLI tool. Since it’s written in python it also suffers from a noticeable cold start when executing as the python interpreter is being launched before it can run any commands.
I was dissatisfied with both of these things, so I went looking for a better, faster implementation. I originally started rewriting with Go, since I was familiar with the language, but then I realized this project was a good opportunity to learn Rust.
I rewrote most of the tool in a few days with guidance from the rust book to get an understanding of the language features, and this handy cheats page as a reference.
soh
now uses a CLI utility called clap, which is stricter than click
with respect to POSIX compliance. Thus, the soh CLI is slightly different, but still straightforward, from what it was in the python implementation.
To install soh
, run
brew install crflynn/formula/soh
From then you can call soh
which brings up the familiar display:
$ soh
soh (sleight-of-hand) 0.2.0
Sleight of hand CLI commands.
(+) indicates subcommand group. Use `soh -c` to copy output
of subcommand to clipboard.
USAGE:
soh [FLAGS] [SUBCOMMAND]
FLAGS:
-c, --clip Copy output of subcommand to clipboard
-h, --help Prints help information
-s, --suppress Suppress console output of subcommand
-V, --version Prints version information
SUBCOMMANDS:
b64 (+) Base64 encode/decode
create (+) Create files
dt (+) Datetimes
epoch (+) Epoch time
help Prints this message or the help of the given subcommand(s)
secret (+) Generate secrets
sys (+) System information
uuid Generate UUIDs
version Show soh version
The new version of soh
(0.2.0) is now available and can be installed via brew as a Rust binary, allowing for much quicker installs and execution, as well as a more compliant interface. It’s currently built for mac and linux.