Skip to content

Repository files navigation

PokédexCLI

A terminal-based Pokédex built with Go. Interact with the PokéAPI through a REPL (Read-Eval-Print Loop) to explore the Pokémon world navigate location areas, discover wild Pokémon, catch them, and manage your personal Pokédex collection.


Features

  • Interactive REPL — a clean command-line shell with a persistent prompt
  • Location navigation — page forward and backward through Pokémon world location areas
  • Area exploration — list all Pokémon available to catch in any location
  • Catch mechanics — attempt to catch Pokémon (success isn't guaranteed!)
  • Pokémon inspection — view detailed stats, types, height, and weight
  • Personal Pokédex — track every Pokémon you've caught
  • In-memory caching — API responses are cached to reduce network calls and improve performance

Prerequisites

  • Go 1.26 or later
  • Docker (no Go install needed)

Installation

# Clone the repository
git clone https://github.com/Resham8/pokedexcli.git

# Navigate into the project directory
cd pokedexcli

# Build the binary
go build -o pokedexcli

# Run it
./pokedexcli

Usage

Once running, you'll see the Pokédex prompt:

Pokedex >

Type any command and press Enter. Use help to see all available commands.

Commands

Command Arguments Description
help Display all available commands
map Show the next 20 location areas in the Pokémon world
mapb Show the previous 20 location areas
explore <location-name> List all Pokémon found in a given location area
catch <pokemon-name> Attempt to catch a Pokémon and add it to your Pokédex
inspect <pokemon-name> View a caught Pokémon's stats, types, height, and weight
pokedex List all Pokémon currently in your Pokédex
exit Exit the program

Example Session

Pokedex > map
- canalave-city-area
- eterna-city-area
- pastoria-city-area
...

Pokedex > explore pastoria-city-area
Exploring pastoria-city-area...
- tentacool
- gyarados
- buizel
...

Pokedex > catch buizel
Throwing a Pokéball at buizel...
buizel was caught!

Pokedex > inspect buizel
Name: buizel
Height: 7
Weight: 295
Stats:
  - hp: 55
  - attack: 65
  - defense: 35
  - special-attack: 60
  - special-defense: 30
  - speed: 85
Types:
  - water

Pokedex > pokedex
Your Pokedex:
  - buizel

Pokedex > exit

Docker

You can run PokédexCLI without installing Go locally using Docker.

Build the image:

docker build -t pokedexcli .

Run the container interactively:

docker run -it pokedexcli

How It Works

  • REPL loopmain.go reads user input in a continuous loop, parses the command and arguments, and dispatches to the registered handler.
  • PokéAPI client — the internal/pokeapi package handles HTTP requests to https://pokeapi.co/api/v2/, unmarshalling JSON responses into Go structs.
  • Caching — the internal/pokecache package wraps API calls with a time-based in-memory cache, so repeated requests to the same endpoint don't trigger redundant network calls.
  • Catch probability — catching a Pokémon uses the Pokémon's base experience stat to influence success probability. Rarer, stronger Pokémon are harder to catch.

About

Interactive Pokédex REPL in Go

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages