valkey
valkey copied to clipboard
Interactive client improvements
I would like to request that the CLI, when used in interactive mode, includes features such as autocompletion, syntax highlighting, and other functionalities listed at https://github.com/laixintao/iredis/, like reverse search and customizable prompts.
These enhancements would make working with Redis much easier and safer. Integrating these features into valkey would provide a significant advantage over Redis, which requires a separate package for such capabilities.
These changes would only apply to the interactive use of valkey-cli, leaving scripted usage unchanged.
Thanks for the suggestion - these features are useful, but I think the valkey-cli should stay simple. It's important to keep the core CLI predictable and lightweight.
@zuiderkwast ?
@xbasel I agree. We can accept contributions if they add nice features without adding a lot of complexity to the code.
It's also totally fine to just use iredis with valkey. We can consider adding a web page where we link to external tools like this. The old redis website used to have that.
I would definitely appreciate if someone can add reverse-search to valkey-cli. I remember there was a community member working on it a while back in Redis OSS.
I think adding colors, autocompletion, etc., would add complexity.
@hpatro One feature I’d love to see in valkey-cli is history search with fzf. I guess it could be implemented by wrapping valkey-cli --pipeline in a script.
looks like valkey-cli --pipe doesn't send any output (response).
Try this: https://github.com/xbasel/random/blob/main/fzf_valkeycli.py
(ctrl+r should open fzf)
marking this as to-be-closed for now
Actually, on second thought, it does make sense to implement basic reverse search in the CLI. I'll keep this issue open for this.
Redis merged the PR around reverse-search after they changed the license https://github.com/redis/redis/pull/12543 and @zuiderkwast had approved the change before the fiasco :| .
Redis and Valkey will evolve over time, and iRedis will eventually not work. I understand the rationale for keeping valkey-cli simple, but I believe it would be beneficial to have a separate project under the official Valkey GitHub organization. This could take the form of an official TUI or a user-friendly, fully-featured CLI like iRedis. Otherwise, there can be a situation similar to Redis, where numerous unofficial TUIs and alternative CLIs emerge that may break, lack security, or become unmaintained.
I would personally like auto-complete and reverse search. That should all be fairly easy to do and should include a lot of functionality.
Coloring I could take or leave.
Coloring isn't just for looks it can help you identify if you've made an error by highlighting things differently than you expected.
Another option would be to make more elements configurable, allowing you to set preferences for aspects like the prompt, highlighting or pager. This way, valkey-cli wouldn't have to handle it on its own, and we could use an external program for those tasks.
Any steps valkey can take to prevent the proliferation of numerous CLI clients due to the built-in client being too basic as seen with redis-cli would be a significant advantage for valkey.
I remember the reverse search PR in redis. It was pretty big and complex. We could ask the author to contribute it again to Valkey if you want... (Personally I never use reverse search in any CLI. I just use the up-arrow for history.)
External pager sounds good. It sounds very simple. We could use less by default in interactive mode, and/or options like --pager and --no-pager and the $PAGER environment variable, similar to other programs such as like git.
Color, e.g. --color=auto|always|never similar to how to use colors with commands like ls. We need to detect the terminal config in some way to pick colors that work with light and dark backgrounds.
Auto-complete can probably be good. Using TAB? It needs its own discussion about how it should work.
We should discuss and implement each feature separately. Let's create sub-issues.