How criomby/pokeget-plus works
Project type and purpose
• pokeget-plus is a standalone Rust CLI application that embeds Pokémon/item sprites and displays them in the terminal.
• It is built and distributed via Cargo, uses a Git submodule for the pokesprite asset library, and runs fully offline, reading embedded data assets.
File structure
• Top-level:
• .github/workflows/build.yml → CI/CD build pipeline
• Cargo.toml/Cargo.lock → Rust project manifest
• src/ → Rust source modules
– main.rs → binary entry point
– cli.rs → command-line argument parsing and help text
– data.rs → data-list loading (items.json, items-list.txt, pokedex-list.txt)
– sprites.rs → sprite selection logic & embedding
– utils.rs → helper functions (randomization, path resolution)
– lib.rs → core library interfaces shared between main.rs and tests
• data/ → static data files (item lists, JSON metadata, raw sprite assets via submodule)
• scripts/ → tooling (e.g., dirs.py to build directory indices)
• .gitmodules → references the pokesprite submodule
Key README insights
• Purpose: “Display Pokémon or items in your terminal” with options for random selection, categories, retro Gen7 sprites.
• Sprites are embedded into the binary at compile time (no runtime download).
• Provides both prebuilt binaries and source installation via cargo install.
• Configuration flags to enable/disable features (--gen7, --no-default-features).
Main components
a. User & Environment
• Terminal / Shell (user input and output rendering)
b. CLI Layer
• main.rs + cli.rs → parse arguments, dispatch commands (pokemon vs. item, random vs. specific)
c. Core Library Layer
• lib.rs → common interfaces and business logic
• utils.rs → helpers for random selection and I/O
d. Data Management Layer
• data.rs → loads JSON/text metadata from embedded resources
• Embedded data assets (items.json, items-list.txt, pokedex-list.txt)
e. Sprite Management Layer
• sprites.rs → selects correct sprite path/bytes based on CLI args
• Submodule: pokesprite (embedded at compile time via include_bytes!)
f. Output Renderer
• Terminal output (print ANSI sequences or raw bytes for sprite images)
g. Build & Deployment
• Cargo build pipeline (Cargo.toml features, submodule initialization, embedding assets)
• CI Workflow (.github/workflows/build.yml) producing release artifacts
Relationships and interactions
• Data Layer → returns metadata
• Sprite Layer → returns sprite bytes
→ Core Library → Renderer → Terminal
Architectural patterns/design principles
• Layered design: clear separation between CLI parsing, business logic, data access, and rendering
• Single binary distribution, embedding all assets (offline first)
• Feature flags for modular inclusion/exclusion of asset sets
• Use of a submodule to separate third-party sprite assets from application code
Essential elements
• Clear labels on each component
• Call out feature-flag inputs (--gen7, --no-default-features) and how they alter embedding