In Part 3 of our Redis CLI project, we take a significant step toward executing commands by implementing user input handling and command parsing. We create CommandHandler.h/.cpp, introduce getline() for input handling, and check for built-in commands like help and quit. Additionally, we implement CommandHandler::splitArgs() to properly tokenize user input, preparing it for Redis command execution.
🔹 Topics Covered:
✅ Created CommandHandler.h/.cpp to manage input processing
✅ Implemented getline() for reading user commands
✅ Added built-in commands: help and quit
✅ Developed splitArgs() to tokenize input commands
✅ Prepared for Redis command formatting in the next part
📌 Source Code:
https://github.com/Cukowski/Redis-CLI
🔔 Stay tuned for Part 4, where we format commands into the Redis protocol (RESP) and send them to the server!
Timestamps:
0:00 - Introduction & recap of Part 2
01:00 - Getting sockfd
03:24 - Starting on the program loop
05:20 - Implementing getline() to read user input
06:30 - Checking for built-in commands: quit
07:25 - Helper trim function
11:10 - Checking for built-in commands: help
12:10 - Understanding why we need command tokenization
13:40 - Creating CommandHandler class
16:20 - Implementing CommandHandler::splitArgs() to split input into tokens
27:50 - Testing user input handling and command splitting
29:00 - Summary & next steps (formatting commands for Redis)