From d199f031e6f3cd067a8e1df13561769e256f94e7 Mon Sep 17 00:00:00 2001 From: Alexander Gehrke Date: Tue, 16 Feb 2021 23:29:32 +0100 Subject: [PATCH] completions: add SVDIR support for zsh Allows sv's completion to complete other service directories, e.g. for per-user services. Currently only zsh, because it is easier than in bash to detect, if the command is prefixed with sudo. --- completions/sv.zsh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/completions/sv.zsh b/completions/sv.zsh index 465fbfd..551beaa 100644 --- a/completions/sv.zsh +++ b/completions/sv.zsh @@ -35,7 +35,11 @@ cmds) check ret=0;; args) - services=( /var/service/*(-/N:t) ) + if [[ $BUFFER == sudo* ]] then + services=( /var/service/*(-/N:t) ) + else + services=( ${SVDIR:-/var/service}/*(-/N:t) ) + fi (( $#services )) && _values services $services && ret=0 [[ $words[CURRENT] = */* ]] && _directories && ret=0 ;;