Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

'sudo chmod' completion of group names



'sudo chown root:<tab>' completes only unix groups I'm in, rather than all
groups in the system.  I'd like it to complete all unix groups in the system.

Would the following make sense? ---

diff --git a/Completion/Unix/Command/_chown b/Completion/Unix/Command/_chown
index 7a7e591..1faedc3 100644
--- a/Completion/Unix/Command/_chown
+++ b/Completion/Unix/Command/_chown
@@ -32,7 +32,7 @@ _arguments -C -s "$args[@]" '*:files:->files' && ret=0
 case $state in
   owner)
     if [[ $service = chgrp ]] || compset -P '*[:.]'; then
-      if (( EGID && $+commands[groups] )); then  # except for root
+      if (( EGID && $+commands[groups] && ! $+funcstack[(r)_sudo] )); then  # except for root
        _wanted groups expl 'group' compadd $(groups) && return 0
       fi
       _groups && ret=0



Messages sorted by: Reverse Date, Date, Thread, Author