Journal 2023-02-28
Scripting in rust
“Scripting” in rust can be consider better than bash, you can package a lot of functionalities in a single statically linked binary that is easy to distribute and use.
Rust has a lot of libraries that can be used to build a CLI application:
- clap: for parsing command line arguments
 - walkdir: for walking a directory tree
 - regex: for parsing text
 - serde: for parsing json
 - reqwest: for making http requests
 
There are also a lot of possibilities throw the ffi:
- libgit2: for interacting with git repositories
 - libssh2: for interacting with ssh servers
 
Finally you can use the std::process module to spawn processes and interact
with processes, or I find it more convenient to use the xshell crate. It
provides a lot of functions to interact with the shell environment and piping
commands. Making the scripting experience very easy,without you having to
manually check the status code of each Command.