This was project was made while learning basics of Go on boot.dev website. I could talk about how amazing boot.dev is but I’ll save that for another time.
Pokedex CLI is a simple CLI application that acts as a Pokedex. It allows you to explore different locations, catch pokemons, inspect their stats and view your pokedex aka caught pokemons. This CLI application works with PokeAPI to get all the necessary data.
Functionalities
map
mapb
explore
catch
inspect
pokedex
help
exit
Map
List page of 10 locations areas. Calling this function again will show the next page of locations. Each call to location areas is stored to local cache so you we don’t hit PokeAPI every time we navigate the page. It just sends a request the first time we are calling for that page
Mapb
List previous page of location areas. Will print message if there is no previous page(When we are on the first page).
Explore
Explore the given location to see pokemon sightings. It will list all the pokemons that can be found in that location.
Catch
Command that tries to catch a pokemon based on random chance and pokemon experience. If you catch a pokemon, it will be added to your pokedex.
Inspect
Inspect stats for pokemon from pokedex. It will show you the stats of the pokemon you have caught. If that pokemon is not in your pokedex, it will show message saying that you haven’t caught that pokemon yet.
Pokedex
Lists all caught pokemons. It will show you all the pokemons you have caught so far.
Help
Displays list of commands and their usage.
Exit
Exits the REPL(Read,Evaluate,Print,Loop)
Takeaways from this project:
- Got familiar with writing Go code
- Learned how to make REPL in Go
- Learned how to interact with REST API in Go
- Practised error handling in Go