Awesome
DiceDB CLI Client
A command-line interface client for DiceDB.
Table of Contents
Features
- Interactive Prompt: Provides an interactive shell to execute DiceDB commands.
- Command Autocompletion: Offers autocompletion for DiceDB commands when typing.
- Watch Commands: Supports custom
.WATCH
and.UNWATCH
commands to reactively receive updated results of specific commands. - Authentication: Supports
AUTH
command to authenticate with the DiceDB server.
Prerequisites
- **Go version 1.23 or later recommended
- DiceDB Server: A running instance of DiceDB. You can find setup instructions on the DiceDB GitHub page.
Installation
-
Clone the Repository:
git clone https://github.com/DiceDB/dicedb-cli.git cd dicedb-cli
-
Download Dependencies:
go mod download
-
Build the Application:
go build -o dicedb-cli
This will generate an executable named
dicedb-cli
in the current directory.
Usage
Starting the CLI
Run the executable to start the interactive prompt:
./dicedb-cli
You should see:
Connected to DiceDB. Type 'exit' or press Ctrl+D to exit.
dicedb>
Basic Commands
You can execute any DiceDB command directly:
dicedb> SET mykey "Hello, World!"
OK
dicedb> GET mykey
"Hello, World!"
dicedb> DEL mykey
(integer) 1
Watch Commands
Receive updated results of supported commands using their .WATCH
variants. These commands keep the prompt in a persistent state, displaying updates when the monitored data changes.
Start Watching a Key:
dicedb> GET.WATCH mykey
The prompt changes to indicate watch mode:
dicedb(get.watch)>
Receive Updates:
When the value of mykey
changes, the new value is displayed:
Command: GET
Fingerprint: 1234567890
Data: "New Value"
Stop Watching a Key:
To exit the watch mode, use the corresponding .UNWATCH
command:
dicedb(get.watch)> GET.UNWATCH 1234567890 # Use the fingerprint from the watch output
Output
OK
dicedb>
Exiting the CLI
Type exit
or press Ctrl+D
to exit the CLI:
dicedb> exit
Command Autocompletion
The CLI provides autocompletion for DiceDB commands when typing the first word. Start typing a command and press Tab
to see suggestions:
dicedb> S # Press Tab
Suggestions:
SET
SUBSCRIBE
SADD
SCAN
- ...
Contributing
Contributions are welcome! Here's how you can help:
-
Fork the Repository:
Click on the
Fork
button at the top right of the repository page. -
Clone Your Fork:
git clone https://github.com/yourusername/dicedb-cli-client.git cd dicedb-cli-client
-
Create a New Branch:
git checkout -b feature/my-new-feature
-
Make Your Changes:
- Add new features or fix bugs.
- Ensure your code follows the project's coding standards.
-
Commit and Push:
git commit -m 'Add new feature' git push origin feature/my-new-feature
-
Submit a Pull Request:
Go to the repository on GitHub and open a pull request.
Development Setup
Ensure you have Go installed and set up on your machine.
Download Dependencies:
go mod download
Run the Application:
go run .
Testing:
Add tests as needed to ensure code reliability.
License
This project is licensed under the MIT License - see the LICENSE file for details.