From 7187ffd3b73d533aba5e715d2c112f815ac8251b Mon Sep 17 00:00:00 2001 From: Evgeniy Alexeev Date: Wed, 8 Jan 2014 14:54:56 +0300 Subject: [PATCH] Update _yaourt I have the next function in .zshrc: pacman () { /usr/bin/sudo /usr/bin/pacman $* && echo "$*" | grep -q "S\|R" && rehash } And I have the next line in `/etc/yaourtrc`: PACMAN="/usr/bin/pacman" But if I try to get autocomplite for `yaourt -Ss` (for example) it requires a sudo password. With this patch path to `pacman` (`PACMAN` variable) will be read from the configuration file and this command will not require the password. It is a correct variant :) --- src/_yaourt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/_yaourt b/src/_yaourt index 9a84b04..e9db0da 100644 --- a/src/_yaourt +++ b/src/_yaourt @@ -186,7 +186,9 @@ _yaourt_completions_repositories() { # $cmd must be declared by calling function _yaourt_get_command() { # this is mostly nicked from _perforce - cmd=( "pacman" ) + cmd=$( grep "^PACMAN=" "/etc/yaourtrc" \ + && grep "^PACMAN=" "/etc/yaourtrc" | cut -c8- \ + || echo "pacman" ) integer i for (( i = 2; i < CURRENT - 1; i++ )); do if [[ ${words[i]} = "--config" || ${words[i]} = "--root" ]]; then