Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: 'sudo chmod' completion of group names
- X-seq: zsh-workers 34413
- From: Peter Stephenson <p.stephenson@xxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: 'sudo chmod' completion of group names
- Date: Tue, 27 Jan 2015 11:04:15 +0000
- In-reply-to: <20150127100655.GD1966@tarsus.local2>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- Organization: Samsung Cambridge Solution Centre
- References: <20150127100655.GD1966@tarsus.local2>
On Tue, 27 Jan 2015 10:06:55 +0000
Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx> 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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author