Skip to content

Commit 80916cc

Browse files
authored
Merge pull request #748 from Migorithm/chore/cli-psuhx
chore: client pushx operations
2 parents 6a3881d + 3bf130a commit 80916cc

2 files changed

Lines changed: 14 additions & 1 deletion

File tree

duva-client/src/cli/editor/completion.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ pub(crate) static COMMANDS: &[&str] = &[
3333
"info replication",
3434
"replicaof",
3535
"lpush",
36+
"lpushx",
3637
"rpush",
38+
"rpushx",
3739
];
3840

3941
macro_rules! new_pair {
@@ -145,7 +147,7 @@ impl Completer for DuvaHinter {
145147
candidates.push(new_pair!("key"));
146148
}
147149
},
148-
| "lpush" | "rpush" => {
150+
| "lpush" | "lpushx" | "rpush" | "rpushx" => {
149151
if previous_words.len() == 1 {
150152
// Suggest "key" after set
151153
candidates.push(new_pair!("key"));

duva-client/src/cli/editor/hints.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,9 @@ pub(crate) fn default_hints() -> HashSet<CommandHint> {
141141
set.insert(CommandHint::new("ttl key", "ttl "));
142142
set.insert(CommandHint::new("replicaof host port", "replicaof "));
143143
set.insert(CommandHint::new("lpush key value [value ...]", "lpush "));
144+
set.insert(CommandHint::new("lpushx key value [value ...]", "lpushx "));
144145
set.insert(CommandHint::new("rpush key value [value ...]", "rpush "));
146+
set.insert(CommandHint::new("rpushx key value [value ...]", "rpushx "));
145147

146148
set
147149
}
@@ -185,10 +187,19 @@ pub(crate) fn dynamic_hints() -> HashMap<&'static str, Vec<DynamicHint>> {
185187
"lpush",
186188
vec![hint!("key value [value ...]", 0, repeat), hint!("[value ...]", 1, repeat)],
187189
);
190+
map.insert(
191+
"lpushx",
192+
vec![hint!("key value [value ...]", 0, repeat), hint!("[value ...]", 1, repeat)],
193+
);
188194
map.insert(
189195
"rpush",
190196
vec![hint!("key value [value ...]", 0, repeat), hint!("[value ...]", 1, repeat)],
191197
);
198+
199+
map.insert(
200+
"rpushx",
201+
vec![hint!("key value [value ...]", 0, repeat), hint!("[value ...]", 1, repeat)],
202+
);
192203
map.insert("replicaof", vec![hint!("host port", 0), hint!("port", 1)]);
193204

194205
map

0 commit comments

Comments
 (0)