| Crates.io | animal-age |
| lib.rs | animal-age |
| version | 1.1.3 |
| created_at | 2025-10-26 20:32:28.055874+00 |
| updated_at | 2025-11-05 17:48:34.381116+00 |
| description | CLI tool to convert animal ages to human years and show lifespan progress |
| homepage | |
| repository | https://github.com/fibnas/animal-age |
| max_upload_size | |
| id | 1901851 |
| size | 32,689 |
animal-age is a colorful Rust CLI that converts pet ages into their human-year equivalents, highlights lifespan progress, and outputs either terminal-friendly bars or machine-readable JSON.
--type flag (Levenshtein distance).--json for piping into scripts, dashboards, or spreadsheets.cargo install --path .
The binary targets Rust 1.70+ (Edition 2021). If you only want to try it locally, running cargo run -- <args> works as well.
animal-age [OPTIONS] --type <ANIMAL>[,<ANIMAL>...] --age <YEARS>
| Flag | Description |
|---|---|
-t, --type |
Animal type; use --list to view valid keys. Accepts comma-separated values or repeated flags. |
-a, --age |
Real age in years (floating point). Must be non-negative. |
--list |
Print supported animals and exit. |
--json |
Emit JSON rows instead of bar charts. |
--no-color |
Disable ANSI coloring (handy for logs or monochrome terminals). |
List the available animal keys:
animal-age --list
Convert one pet and show colored bars:
animal-age --type cat --age 3
Compare multiple pets and export JSON:
animal-age -t cat,small_dog -a 3 --json
Or repeat the -t flag to compare multiple animals at the same age:
animal-age -a 3 -t cat -t small_dog
Sample JSON payload:
{
"animal": "cat",
"age": 3.0,
"human_age": 29.0,
"animal_max_lifespan": 18.0,
"human_max_lifespan": 80.0,
"animal_progress": 0.16666667,
"human_progress": 0.3625
}
| Key | Description | Typical Max Age |
|---|
small_dog | Small dog (e.g., terrier) | 16 years
medium_dog | Medium dog (e.g., spaniel) | 14 years
big_dog | Large dog (e.g., retriever) | 10 years
cat | Domestic cat | 18 years
horse | Horse | 30 years
pig | Pig | 20 years
parakeet | Parakeet / budgie | 10 years
snake | Common pet snake | 20 years
goldfish | Goldfish | 15 years
rabbit | Rabbit | 12 years
hamster | Hamster | 3 years
cargo fmt # format (if needed)
cargo clippy # lint
cargo test # run unit tests
The existing tests focus on conversion math, but feel free to add more coverage around lifespan bars or CLI parsing as you extend the tool. Contributions are welcome under the MIT license (see LICENSE).