about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--Completion/Unix/Command/_sudo7
-rw-r--r--Doc/Zsh/compsys.yo8
2 files changed, 15 insertions, 0 deletions
diff --git a/Completion/Unix/Command/_sudo b/Completion/Unix/Command/_sudo
index 2b5a5cb7d..b4c002168 100644
--- a/Completion/Unix/Command/_sudo
+++ b/Completion/Unix/Command/_sudo
@@ -1,5 +1,12 @@
 #compdef sudo
 
+local curcontext="$curcontext" environ e
+zstyle -a "$curcontext" environ environ
+
+for e in "${environ[@]}"
+do local -x "$e"
+done
+
 _arguments \
        '-V[show version]' \
        '-l[list allowed commands]' \
diff --git a/Doc/Zsh/compsys.yo b/Doc/Zsh/compsys.yo
index 54684db14..77e6a8983 100644
--- a/Doc/Zsh/compsys.yo
+++ b/Doc/Zsh/compsys.yo
@@ -1312,6 +1312,14 @@ A list of names of network domains for completion.
 If this is not set, domain names will be taken from
 the file tt(/etc/resolv.conf).
 )
+kindex(environ, completion style)
+item(tt(environ))(
+The environ style is used when completing for `tt(sudo)'.  It is set to an
+array of `var(VAR)tt(=)var(value)' assignments to be exported into the
+local environment before the completion for the target command is invoked.
+example(zstyle :complete:sudo: environ \
+  PATH="/sbin:/usr/sbin:$PATH" HOME="/root")
+)
 kindex(expand, completion style)
 item(tt(expand))(
 This style is used when completing strings consisting of multiple