aboutsummaryrefslogtreecommitdiff
path: root/completions
diff options
context:
space:
mode:
authortiosgz <alamica@protonmail.com>2023-10-01 15:49:21 +0000
committertiosgz <alamica@protonmail.com>2023-10-16 17:04:40 +0000
commitd73ef51c89c67ab2125387d20488a32654507e73 (patch)
treee03b08948cb59e296a82dc47cb52fcd2bfca5340 /completions
parent5690c833e9ba0ea5dc342b229ce307aa4551470b (diff)
downloadriver-d73ef51c89c67ab2125387d20488a32654507e73.tar.gz
river-d73ef51c89c67ab2125387d20488a32654507e73.tar.xz
riverctl: rule-{add,del}: reorder parameters
Previous order was (action, conditions, action argument), current is (conditions, action, action argument). The old one was an expansion of (action, conditions), which itself most likely came from the separate <action>-filter-add commands. On the other hand, the new order keeps action and its argument together and is in line with the logical flow (check conditions, apply action). On shell completions: only bash absolutely needed to be updated. fish and zsh slightly misbehave regardless of the order.
Diffstat (limited to 'completions')
-rw-r--r--completions/bash/riverctl21
1 files changed, 20 insertions, 1 deletions
diff --git a/completions/bash/riverctl b/completions/bash/riverctl
index f3d8674..395c6f2 100644
--- a/completions/bash/riverctl
+++ b/completions/bash/riverctl
@@ -1,5 +1,6 @@
function __riverctl_completion ()
{
+ local rule_actions="float no-float ssd csd tag"
if [ "${COMP_CWORD}" -eq 1 ]
then
OPTS=" \
@@ -63,7 +64,7 @@ function __riverctl_completion ()
"focus-view"|"swap") OPTS="next previous up down left right" ;;
"move"|"snap") OPTS="up down left right" ;;
"resize") OPTS="horizontal vertical" ;;
- "rule-add"|"rule-del") OPTS="float no-float ssd csd tag" ;;
+ "rule-add"|"rule-del") OPTS="-app-id -title $rule_actions" ;;
"list-rules") OPTS="float ssd tag" ;;
"map") OPTS="-release -repeat -layout" ;;
"unmap") OPTS="-release" ;;
@@ -114,6 +115,24 @@ function __riverctl_completion ()
"scroll-method") OPTS="none two-finger edge button" ;;
*) return ;;
esac
+ elif [ "${COMP_WORDS[1]:0:5}" == "rule-" ]
+ then
+ case "${COMP_WORDS[2]}" in
+ "-app-id") OPTS="-title $rule_actions" ;;
+ "-title") OPTS="-app-id $rule_actions" ;;
+ *) return ;;
+ esac
+ COMPREPLY=($(compgen -W "${OPTS}" -- "${COMP_WORDS[4]}"))
+ fi
+ elif [ "${COMP_CWORD}" -eq 6 ]
+ then
+ if [ "${COMP_WORDS[1]:0:5}" == "rule-" ]
+ then
+ case "${COMP_WORDS[4]}" in
+ "-app-id"|"-title") OPTS="$rule_actions" ;;
+ *) return ;;
+ esac
+ COMPREPLY=($(compgen -W "${OPTS}" -- "${COMP_WORDS[6]}"))
fi
else
return