diff options
author | Peter Stephenson <pws@users.sourceforge.net> | 2008-07-21 19:15:22 +0000 |
---|---|---|
committer | Peter Stephenson <pws@users.sourceforge.net> | 2008-07-21 19:15:22 +0000 |
commit | 5b29fedad850299950195a1878fe4923778f9dcc (patch) | |
tree | 100a2decba0f1b6f8c4ed1b866bddd5f2ff57019 /Completion/Solaris/Command/_pfexec | |
parent | 2d2d341161ca6699a6efd6981c3a9fd7fe52e6d6 (diff) | |
download | zsh-5b29fedad850299950195a1878fe4923778f9dcc.tar.gz zsh-5b29fedad850299950195a1878fe4923778f9dcc.tar.xz zsh-5b29fedad850299950195a1878fe4923778f9dcc.zip |
25324: Danek Duvall: some Solaris and more general completions
Diffstat (limited to 'Completion/Solaris/Command/_pfexec')
-rw-r--r-- | Completion/Solaris/Command/_pfexec | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/Completion/Solaris/Command/_pfexec b/Completion/Solaris/Command/_pfexec new file mode 100644 index 000000000..227336223 --- /dev/null +++ b/Completion/Solaris/Command/_pfexec @@ -0,0 +1,31 @@ +#compdef pfexec + +# This is a _values-like function that completes privileges and !-prefixed +# privileges, comma-separated, and unique. +_privset() { + local expl p + local -a privs + + privs=( ${(f)"$(ppriv -l)"} all none zone basic ) + + # Ignore existing values + compset -P '*,' + # Ignore a leading !, maybe backslash-quoted + compset -P '\\#!' + + # Remove already-referenced privs + for p in ${(s:,:)${IPREFIX//\\#\!/}}; do + privs=( ${privs:#$p} ) + done + + _wanted privs expl 'privilege' compadd -qS , -a privs +} + +_pfexec() { + _arguments \ + '-P[privileges to acquire]:privspec:_privset' \ + '(-):command name: _command_names -e' \ + '*::arguments: _normal' +} + +_pfexec "$@" |