Skip to content

minettekaum/pokedex_cli

Repository files navigation

Pokedex

This project is part of boot.dev. The assignment was Build a REPL pokedex on the command line in Go.

It's a Pokedex-like REPL in Go. It uses the PokeAPI to fetch data about different Pokemons. You can move the map, search for, catch, and inspect different Pokemons.

The goal of this project is to learn Go and to:

  • become comfortable with JSON APIs
  • make network requests
  • implement caching

How to run it

  • Make sure you have Go installed
  • Clone the git repo
git clone https://github.com/minettebrink/pokedex_cli.git
cd pokedex_cli
  • Build from source with:
go mod tidy 
go build 
  • Start the application
./pokedex_cli

How to use it

Type help to get further instructions

Pokedex > help 

After typing help, you will get the following output.

Welcome to the Pokedex!
Usage:

mapb: Get the previous page of locations
pokedex: See all the pokemon you've caught
exit: Exit the Pokedex
help: Displays a help message
catch <pokemon_name>: Attempt to catch a pokemon
inspect <pokemon_name>: View details about a caught Pokemon
explore <location_name>: Explore a location
map: Get the next page of locations

Pokedex >

Type map to see what locations you can go, with mapb can you go back a page.

Pokedex > map
canalave-city-area
eterna-city-area
pastoria-city-area
sunyshore-city-area
sinnoh-pokemon-league-area
...

Use explore to see what Pokemons are in that location.

Pokedex > explore canalave-city-area
Exploring canalave-city-area...
Found Pokemon: 
 - tentacool
 - tentacruel
 - staryu
 - magikarp
 - gyarados
 ...

Continue by catching Pokemons and creating an impressive Pokedex!

Project workflow

I started with creating the REPL, implemented in repl.go, along with basic commands:

Next, I integrated the PokeAPI to enable fetching Pokémon data.

To enhance the user experience, I implemented caching in pokecache directory. This allows for certain data to be stored rather than constantly requested.

After this, I added various commands to be able to move and catch Pokemons:

  • The command map, implemented incommand_map.go, displays 20 locations within the Pokémon world.
  • The command mapb, implemented incommand_mapb.go, shows the 20 previous locations for easier navigation.
  • For exploring different locations: explore <location>, implemented in command_explore.go.
  • To be able to catch Pokémons: catch <pokemon_name>, implemented in command_catch.go
  • After catching a Pokémon, you can inspect it using the command inspect <pokemon_name>, implemented in command_inspect.go.
  • Finally, the pokedex command lets you view all the Pokémon you've caught, implemented in command_pokedex.go.

Submit a pull request

If you'd like to contribute, please fork the repository and open a pull request to the main branch.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages