| Crates.io | pokemonsay |
| lib.rs | pokemonsay |
| version | 0.1.2 |
| created_at | 2019-08-04 05:08:01.335336+00 |
| updated_at | 2025-12-01 01:27:09.288194+00 |
| description | Pokemon version of cowsay |
| homepage | |
| repository | https://github.com/dfrankland/pokemonsay |
| max_upload_size | |
| id | 154056 |
| size | 11,165,918 |
pokemonsayPokemon version of cowsay, powered by PokeAPI.
https://github.com/user-attachments/assets/36cc94e7-5bec-4235-88eb-1cf190d562b4
Inspired by another pokemonsay and parrotsay-api I created this to
quell my obsession with Pokemon and command line greetings.
Simply call pokemonsay to get a random Wild POKEMON appeared! message.
Pipe to pokemonsay to get a random Pokemon with the piped message below it.
Install with Cargo:
cargo install pokemonsay
Or use the Nix flake:
nix run 'github:dfrankland/pokemonsay'
Run pokemonsay --help to see all available options.
Display a random Pokemon with the default message:
pokemonsay
Pipe a custom message to display with a random Pokemon:
echo "Your message here" | pokemonsay
--query-method <METHOD>
db, httpdb (if embedded), http (otherwise)db: Queries a local SQLite database (faster, no rate limit)http: Queries PokeAPI GraphQL endpoint (rate limit: 200 queries/hour)--db-path <PATH>
POKEMONSAY_DB_PATH environment variable--query-method db (in non-embedded builds)pokemonsay --db-path ./pokeapi.db--sprites-retrieval-method <METHOD>
embedded, httpembedded (if available), http (otherwise)embedded: Uses sprites built into the CLI (fastest)http: Downloads from PokeAPI sprites repository--pokemonsay-template <TEMPLATE>
{pokemon} as the Pokemon name placeholder"Wild {pokemon} appeared!"pokemonsay --pokemonsay-template "I choose you, {pokemon}!"--crop-sprite-transparent-bg
pokemonsay --crop-sprite-transparent-bg--max-sprite-dimension <DIMENSION>
0 to disable scaling (useful for terminals without image support)30 (for terminals that support Kitty, iTerm2, or Sixel graphics
protocols), 0 (for others)pokemonsay --max-sprite-dimension 50These options are used in conjunction with the SQLite database from PokeAPI.
--db-pokemon-query <QUERY>
--query-method db)pokemonsay --help to see the default query--db-sprites-query <QUERY>
--query-method db)pokemonsay --help to see the default query--db-species-name-query <QUERY>
--query-method db)pokemonsay --help to see the default queryThis option is used in conjunction with the PokeAPI GraphQL endpoint which you can play with here: https://graphql.pokeapi.co/v1beta2/console/
--http-graphql-query <QUERY>
--query-method http)pokemonsay --help to see the default queryDisplay with HTTP query method and custom template:
pokemonsay --query-method http --pokemonsay-template "{pokemon} is awesome!"
Display with transparent background cropping and custom sprite size:
pokemonsay --crop-sprite-transparent-bg --max-sprite-dimension 40
Use a custom database:
pokemonsay --query-method db --db-path /path/to/pokeapi.db
Pipe a message with custom styling:
echo "🎮 Get ready for battle! 🎮" | pokemonsay --crop-sprite-transparent-bg
This crate is built with a SQLite database from PokeAPI. The database and sprite assets can be included in the binary at compile-time or referenced at runtime, depending on your build configuration and needs.
The recommended way to build and package pokemonsay is with Nix, which
automates the PokeAPI database and sprites extraction:
nix build
# outputs the binary to `./result/bin/pokemonsay`
This approach:
If you're not using Nix, follow these steps:
Clone and build the PokeAPI database:
Clone the PokeAPI repository and follow its build instructions:
git clone --recurse-submodules https://github.com/PokeAPI/pokeapi.git
cd ./pokeapi
make setup
make build-db
Build pokemonsay:
EMBED_DB_PATH="$(realpath ./pokeapi/db.sqlite3)" \
EMBED_SPRITES_PATH="$(realpath ./pokeapi/data/v2/sprites/sprites)" \
cargo build --release --features embed-db,embed-sprites
pokemonsay provides two compile-time features that control what assets are
embedded in the binary:
embed-db (default)When enabled, you can still use --query-method http to query PokeAPI instead,
or --db-path to specify an external database.
embed-sprites (optional)--sprites-retrieval-method embedded is availableWhen enabled, you can still use --sprites-retrieval-method http to download
sprites instead.
Fastest, largest binary (full embedding):
cargo build --release --features embed-db,embed-sprites
Balanced (embedded database, HTTP sprites):
cargo build --release --features embed-db
Smallest binary (requires runtime setup):
cargo build --release --no-default-features
Defaults to using HTTP calls to PokeAPI.
Optionally, provide database and sprites at runtime:
pokemonsay --query-method db --db-path /path/to/pokeapi.db
Looking for the previous version written in JavaScript? Find it on the v1
branch.