Rust-Based Utilities
Rust has been recently named as the most loved language on Stackoverflow one more time. Currently it is not widely used in professional development, therefore developers often develop small programs to try it out. One obvious choice for these programs are different command line utilities, thus the number of such tools developed in Rust constantly grows. On crates.io, there is even a separate category devoted to these programs. Therefore, I have decided to write an article about the utilities I find useful in order to have their list in one place. I plan to update this article as I try more utils.
Table of Contents
cargo
tool. However, they may be also packed into the native operating systems formats. Please, read the documentation in order to find out other installation methods of the utils.Cargo-Update
Cargo-update is a cargo subcommand to check and apply updates to installed executables. If you install binaries using
cargo install
command, this utility allows you to update them all together at once.
- Crates.io: https://crates.io/crates/cargo-update
- Repository: https://github.com/nabijaczleweli/cargo-update
- Documentation: https://rawcdn.githack.com/nabijaczleweli/cargo-update/doc/cargo_update/index.html
- Installation:
cargo install cargo-update
(check repository for necessary dependencies)
Usage
First, using this utility you can check if any of the binaries installed with cargo
requires updates. In order to do this, run the utility with -l
(--list
) flag:
$ cargo install-update -l
Updating registry 'https://github.com/rust-lang/crates.io-index'
Package Installed Latest Needs update
cargo-update v7.0.1 v7.0.1 No
tealdeer v1.4.1 v1.4.1 No
...
You can update all packages requiring update providing -a
(--all
) flag. If you add -f
(--force
) flag, all the packages will be updated regardless if they need update. The -g
(--git
) forces the utility to update also git packages:
$ cargo install-update -a -f -g
If you want to update just a set of selected packages, list them after the command name. You can add -i
(--allow-no-update
) in order to install the package if it is not yet installed:
$ cargo install-update -i tealdeer
Using -c <CARGO_DIR>
(--cargo-dir <CARGO_DIR>
) and -t <TEMP_DIR>
(--temp-dir <TEMP_DIR>
) options it is possible to specify the location of the cargo directory, and what temporary directory to use to download and build git packages. If these values are not provided, cargo-update fails safe to system default locations ($CARGO_HOME
or $HOME/.cargo
and the system temporary directory correspondingly).
Tealdeer
Tealdeer is one of the fastest implementations of tldr, a project aimed at providing concise help descriptions for command line utils. It is like man, but provides a short and simple help text with the main usage examples.
- Crates.io: https://crates.io/crates/tealdeer
- Repository: https://github.com/dbrgn/tealdeer
- Documentation: https://dbrgn.github.io/tealdeer/
- Installation:
cargo install tealdeer
Usage
The basic usage of this tool is pretty simple. After the installation, just execute the following command:
$ tldr <command>
For instance, to get a short documentation on strace
command, run the following directive (while it is not visible here, the text output is colored):
$ tldr strace
Troubleshooting tool for tracing system calls.
Start tracing a specific process by its PID:
strace -p pid
Trace a process and filter output by system call:
strace -p pid -e system_call_name
Count time, calls, and errors for each system call and report a summary on program exit:
strace -p pid -c
Show the time spent in every system call:
strace -p pid -T
Start tracing a program by executing it:
strace program
Start tracing file operations of a program:
strace -e trace=file program
When you install the utility, tealdeer downloads a database (cache) with the data on commands. This database is populated by the community, so tealdeer has options to control the local cache.
$ tldr -l # use -l or --list to list all the commands in the local cache
$ tldr -c # use -c or --clear-cache flag to clear the local cache
$ tldr -u # use -u or --update to update the local cache
By default, tealdeer provides help on your operating system relevant commands. For instance, on my Kubuntu-driven machine, it will issue help text relevant to Linux command line utils. If you run Linux but want to get help for Windows-based tool, you can override the operating system using -o
or --os
options:
$ tldr cmd
Page cmd not found in cache
Try updating with `tldr --update`, or submit a pull request to:
https://github.com/tldr-pages/tldr
$ tldr --os windows cmd
The Windows command interpreter.
...