zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.stephenson@samsung.com>
To: zsh-workers@zsh.org
Subject: Re: 'sudo chmod' completion of group names
Date: Tue, 27 Jan 2015 11:04:15 +0000	[thread overview]
Message-ID: <20150127110415.40277f20@pwslap01u.europe.root.pri> (raw)
In-Reply-To: <20150127100655.GD1966@tarsus.local2>

On Tue, 27 Jan 2015 10:06:55 +0000
Daniel Shahaf <d.s@daniel.shahaf.name> wrote:
> '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

Yes, that seems a neat solution to the problem, thanks.

pws


      reply	other threads:[~2015-01-27 11:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-27 10:06 Daniel Shahaf
2015-01-27 11:04 ` Peter Stephenson [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150127110415.40277f20@pwslap01u.europe.root.pri \
    --to=p.stephenson@samsung.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).