Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion duva-client/src/cli/editor/completion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ pub(crate) static COMMANDS: &[&str] = &[
"info replication",
"replicaof",
"lpush",
"lpushx",
"rpush",
"rpushx",
];

macro_rules! new_pair {
Expand Down Expand Up @@ -145,7 +147,7 @@ impl Completer for DuvaHinter {
candidates.push(new_pair!("key"));
}
},
| "lpush" | "rpush" => {
| "lpush" | "lpushx" | "rpush" | "rpushx" => {
if previous_words.len() == 1 {
// Suggest "key" after set
candidates.push(new_pair!("key"));
Expand Down
11 changes: 11 additions & 0 deletions duva-client/src/cli/editor/hints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,9 @@ pub(crate) fn default_hints() -> HashSet<CommandHint> {
set.insert(CommandHint::new("ttl key", "ttl "));
set.insert(CommandHint::new("replicaof host port", "replicaof "));
set.insert(CommandHint::new("lpush key value [value ...]", "lpush "));
set.insert(CommandHint::new("lpushx key value [value ...]", "lpushx "));
set.insert(CommandHint::new("rpush key value [value ...]", "rpush "));
set.insert(CommandHint::new("rpushx key value [value ...]", "rpushx "));

set
}
Expand Down Expand Up @@ -185,10 +187,19 @@ pub(crate) fn dynamic_hints() -> HashMap<&'static str, Vec<DynamicHint>> {
"lpush",
vec![hint!("key value [value ...]", 0, repeat), hint!("[value ...]", 1, repeat)],
);
map.insert(
"lpushx",
vec![hint!("key value [value ...]", 0, repeat), hint!("[value ...]", 1, repeat)],
);
map.insert(
"rpush",
vec![hint!("key value [value ...]", 0, repeat), hint!("[value ...]", 1, repeat)],
);

map.insert(
"rpushx",
vec![hint!("key value [value ...]", 0, repeat), hint!("[value ...]", 1, repeat)],
);
map.insert("replicaof", vec![hint!("host port", 0), hint!("port", 1)]);

map
Expand Down
Loading