My first CLI project

Ben Kramer
1 min readMar 21, 2021

I made my project cetered around one of my favorite book series, The Lord of the Rings. I wanted to make it easy for someone to look up a character with parameters to avoid having to sort though 1200 different characters. My CLI file is simple, it asks for user input for the first parameter (gender) and then it ask for the second parameter (race) to then yield a list of characters that fit thow two parameters.

I originally started out with a one way path for the early version of my project and the user was only able to go forwards and not able to restart without exiting and relaunching the program. I fixed this by adding a .while true loop where the app loops until a valid input is received. The original project had a bug where and input given was registered as valid and would return an infinite list of characters.

The program initially creates a pool of available characters and then requests the user to input a value (male/female) to narrow the pool. Making a selection narrows a copy of the original pool and then narrows it down for the user to not alter the original pool. This is repeated two more times until a single character is selected and then specific stats are displayed about the character. The user can then search for a new character or type Q to quit the application.

--

--