The first step in creating my CLI project was to decide what type of API I wanted to use. In the beginning, I was interested in using an API for horoscopes. As I researched further, I discovered that there were no free horoscope APIs available. I decided to change my first idea and look through all the free APIs until I found one that I liked; upon my search, I found the PokeApi. The PokeApi is an excellent resource; it provides a plethora of information regarding the world of Pokémon. After reading through their detailed documentation, I began my journey forward in creating my CLI.
I started my journey by creating a notes file where I wrote down my objectives for the project. My objective was to use my source, PokeApi, to return the first generation of Pokémon and their descriptions upon the user’s choice. To start this, I began with creating my API, CLI, and Pokémon folder.
- My CLI class deals with the information showing onto the terminal.
- My API class deals with all my API information.
- My Pokémon class deals with all Pokémon names and their corresponding information.
In the Pokémon folder I had to refactor. In the beginning, I initialized only the name and URL. When running my code, I could not access all the information for the Pokémon. I quickly learned I had to initiate all the attributes in order to iterate over the class variable when needed in my CLI class.
After creating all of my folders and defining the start method, I decided to add a little spice to the CLIs appearance. I found a Pokémon text art from ASCII art that I wanted to display to the user when the program is started. To display the text, I created a folder, poke.txt, that contained my Pokémon text. I then defined the method and requested the file poke.txt be opened and displayed for the user at the start of the program.
The moment when I ran the code, and it worked, was a moment of joy! When I started this project, I was concerned; I thought I would be unable to think of an idea and execute the said idea adequately. Fortunately, I proved my self-doubt wrong. As I become more comfortable with coding, I gain more confidence in the work I create. If there is one piece of advice, I could give you, please, do not give up! You will get it, watch one more tutorial, read through another post on stack overflow; you can do this!