dota2cat

Crates.iodota2cat
lib.rsdota2cat
version0.3.2
created_at2021-11-15 23:30:06.195829+00
updated_at2025-10-12 11:22:51.748018+00
descriptionAn updated fork of dotacat (which is like lolcat, but fast)
homepagehttps://gitlab.com/Lynnesbian/dota2cat
repositoryhttps://gitlab.com/Lynnesbian/dota2cat
max_upload_size
id482402
size198,598
Lynne (Lynnesbian)

documentation

README

dota2cat

Dependency status License Pipeline status Downloads

This is an updated version of the dotacat crate. The original crate's name was a pun on lolcat (because DOTA is a similar game to LOL), so I named mine "DOTA 2 cat" :L

The main feature is a moderately faster implementation by using a buffered writer:

lynne@pasiphael:~/Projects/Code/rust/dota2cat (master) 37ms 1.12% 9GiB/31GiB
❯ hyperfine 'pv /usr/share/dict/linux.words | ~/temp/buffered > out' 'pv /usr/share/dict/linux.words | ~/temp/println > out'
Benchmark 1: pv /usr/share/dict/linux.words | ~/temp/buffered > out
  Time (mean ± σ):      1.923 s ±  0.044 s    [User: 1.766 s, System: 0.120 s]
  Range (min … max):    1.844 s …  1.981 s    10 runs
 
Benchmark 2: pv /usr/share/dict/linux.words | ~/temp/println > out
  Time (mean ± σ):      2.870 s ±  0.049 s    [User: 1.967 s, System: 0.845 s]
  Range (min … max):    2.815 s …  2.983 s    10 runs
 
Summary
  pv /usr/share/dict/linux.words | ~/temp/buffered > out ran
    1.49 ± 0.04 times faster than pv /usr/share/dict/linux.words | ~/temp/println > out

(buffered is the new implementation, println is the original. Measured with hyperfine)

In terms of throughput, pv measured the original at 2.04 MiB/s, and the new one at 2.75 MiB/s.

I've also updated the dependencies, modernised it to use Rust edition 2021, and fixed an issue with a breaking change in clap.

Installation

dota2cat can be installed with cargo, Rust's package/dependency manager:

cargo install dota2cat

To more easily facilitate replacing dotacat with dota2cat, the executable is still named dotacat.

The original README continues below.

dotacat

dotacat is meant to be a replacement to lolcat. If you're not aware, lolcat is a rather silly program which behaves like cat, but produces a colourful, rainbow output.

Why?

Speed!

$ time echo hi | lolcat
real    0m0.422s
user    0m0.393s
sys     0m0.028s

I use lolcat in my .bashrc file, so this amount of time is not ideal for me.

In contrast:

time echo hi | dotacat

real    0m0.045s
user    0m0.030s
sys     0m0.020s

Why the name?

Because Dota is better than LoL (According to people - I play neither)

Installation

If you have cargo installed, just run: cargo install dotacat

If not, head over to the releases page and download the latest release. Then run:

chmod +x dotacat
sudo mv dotacat /usr/local/bin

Usage

USAGE:
    dotacat [FLAGS] [OPTIONS] [files]...

ARGS:
    <files>...    Files to concatenate(`-` for STDIN)

FLAGS:
    -h, --help       Prints help information
    -i, --invert     Invert fg and bg
    -V, --version    Prints version information

OPTIONS:
    -F, --freq <freq>        Rainbow frequency [default: 0.1]
    -S, --seed <seed>        Rainbow seed, 0 = random [default: 0.0]
    -p, --spread <spread>    Rainbow spread [default: 1.0]

Examples:
	dotacat f - g	Output f's contents, then stdin, then g's contents.
	fortune | dotacat	Display a rainbow cookie.
Commit count: 70

cargo fmt