Skip to content

Commit

Permalink
completions: add SVDIR support for zsh
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
crater2150 committed Feb 16, 2021
1 parent 727b2a5 commit d199f03
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion completions/sv.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -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
;;
Expand Down

0 comments on commit d199f03

Please sign in to comment.