Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: sudo processes completion with zstyle -e
- X-seq: zsh-users 12764
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-users ml <zsh-users@xxxxxxxxxx>
- Subject: Re: sudo processes completion with zstyle -e
- Date: Sun, 06 Apr 2008 18:24:17 -0700
- In-reply-to: <5FAB16E1-5673-43DB-9E88-1D7D18DE1AAA@xxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <5FAB16E1-5673-43DB-9E88-1D7D18DE1AAA@xxxxxxxxxxx>
On Apr 7, 1:25am, Sebastian Stark wrote:
}
} When using sudo it seems the $words array is not that useful in the
} following context:
}
} zstyle -e ':completion:*:processes' command 'if [[ $words[1] ==
} sudo ]] reply="ps auxw"'
That's because the _sudo function is defined to call the _normal
completer on everything after the command name argument, which has
the effect of hiding the "sudo" and making the completion system
believe that the command line begins with "kill", so that options
etc. for kill are completed.
} Is there another way to find out whether a command is run with sudo?
Try this:
zstyle -e ':completion:*:processes' command \
'if (( $funcstack[(eI)$_comps[sudo]] )) reply="ps auxw"'
That says "if the current call stack includes the completer for sudo,
then ...".
Messages sorted by:
Reverse Date,
Date,
Thread,
Author