From d73ef51c89c67ab2125387d20488a32654507e73 Mon Sep 17 00:00:00 2001 From: tiosgz Date: Sun, 1 Oct 2023 15:49:21 +0000 Subject: 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 -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. --- completions/bash/riverctl | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'completions/bash') 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 -- cgit v1.2.3