2 releases
0.1.2 | Nov 25, 2022 |
---|---|
0.1.1 | Nov 24, 2022 |
#190 in Text processing
1MB
133 lines
random_ascii (rust version)
A totally useless but 'must have' bloatware (tribute to systemd)
random_ascii is a simple binary that picks a random ascii art file in your collection, which fits in your current terminal (checking terminal and file size)...
File sizes are fully parsed just one time, and cached in fileDB, to offer better performance and avoid unnecessary disk accesses...
- currently tested on Debian/Ubuntu, Arch/Manjaro
- copyleft, do what you want, copy, modify... sell if you can ;P but keep on sharing
- use at your own risks (check your ascii files before !)
- uses
cargo
for building, and for a better experience, you should install thedotacat
package (default renderer)
Install
The easiest way (with cargo)
Install dotacat
or a renderer of your choice
cargo install dotacat
cargo install random_ascii
Manually (if you don't want to use cargo)
While it's possible to use cat
, you may wish to output fancy colors.
On Debian based distros
sudo apt install lolcat
And for Arch ones
sudo pacman -S lolcat
Then, just put the random_ascii binary somewhere in your $PATH
,
and make it executable, typically :
echo $PATH
curl -fSsL https://gitlab.com/flashbios/rust_random_ascii/-/raw/main/latest_release/random_ascii?inline=false -o ~/.local/bin/random_ascii
chmod +x ~/.local/bin/random_ascii
Usage
Case 1 : you're already ok with the default options
- I want to use dotacat which is already installed
- my ascii repo is writable and at
${HOME}/.config/random_ascii/
- all my ascii files have the
.ascii
extension - my prompt is just 1 line height
random_ascii
Case 2 : you may want to change some option
- -p=path from your HOME directory, without leading or trailing slashes (must be writable to get the cache.bin active)
- -e=extension
- -h=prompt_height (will be subtracted to the height of the terminal, to filter files that are too tall to fit in)
- -r will reset cache db (just once, to force parsing files again) with obvious lower performance but fresh data
- -d=display_renderer (if you prefer
cat
ordot2acat
or whatever...)
random_ascii -p=Documents/my_ascii_files -e=txt -d=cat -h=4 -r
When you're ok with the command, you can append it to your .bashrc
, .zshrc
...
... fits well just before a starship prompt
Dependencies
~10–15MB
~126K SLoC