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

Re: sudo autocompletion



On Mon, 2020-02-10 at 11:13 -0600, dana wrote:
> On 10 Feb 2020, at 01:52, Andrey <butirsky@xxxxxxxxx> wrote:
> > 
> > Thanks, will try it. How about to include it in distribution by default?
> Would this be too cheeky?
> 
> There's not much precedent for this sort of thing (just cache-policy), but i
> don't think it'd cause any issues, aside from showing too many commands in
> some uncommon cases...?
>
> +  zstyle -t ":completion:${curcontext}:" command-path ||
> +  zstyle -e ":completion:${curcontext%:}:*" command-path \
> +    'reply=( $path ${path/%\/bin//sbin} )'

I think it ought at least to check if the /sbin directories exist.
Possibly they should also go in front of the path --- that's one of the
points about "secure".

On the issue of setting the style at this point --- the usual behaviour
is only to change the default locally rather than also set the style, but
that's probably difficult here, so I don't think it's a particularly big
deal.

pws



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