This "redis-cli" project, developed in Go, was created as part of the "Coding Challenge #37 - Redis CLI Tool" by John Crickett. It's designed for effective interaction with Redis servers, encompassing serialization and deserialization of RESP messages, establishing network connections, and offering a user-friendly interface for executing Redis commands.
- RESP Serialization/Deserialization ๐พ: Handles encoding and decoding of RESP messages.
- Network Connection ๐: Establishes connections to Redis servers.
- Command Line Interface โจ๏ธ: Offers an interactive CLI for executing Redis commands.
- Flexible Server Connection ๐: Allows specifying host and port for the Redis server.
- Extended Command Support ๐ ๏ธ: Includes a help command with detailed descriptions of Redis commands.
- Go (version 1.21 or higher) ๐น
- Redis server ๐ฆ
-
Clone the repository:
git clone https://github.com/afonsocraposo/redis-cli
-
Navigate to the project directory:
cd redis-cli
-
Build the project:
go build -o redis-cli cmd/redis-cli/redis-cli.go
Run the CLI tool:
./redis-cli
Specify the host and port:
./redis-cli -h [hostname] -p [port]
Enter commands in the interactive mode:
localhost:6379> set key value
OK
localhost:6379> get key
value
Access help for Redis commands:
localhost:6379> help set
SET key value [NX|XX] [GET] [EX seconds|PX milliseconds|EXAT unix-time-seconds|PXAT unix-time-milliseconds|KEEPTTL]
summary: Sets the string value of a key, ignoring its type. The key is created if it doesn't exist.
since: 1.0.0
group: string
- The project includes a suite of test cases following the Test-Driven Development (TDD) approach.
- Run the tests to ensure the functionality of serialization, deserialization, and command execution.
Contributions to enhance the "redis-cli" tool are welcome. Please follow the standard fork, branch, and pull request workflow.
Distributed under the MIT License. See LICENSE
for more information.