diff options
author | dana <dana@dana.is> | 2018-01-03 18:14:05 -0600 |
---|---|---|
committer | Oliver Kiddle <opk@zsh.org> | 2018-01-04 11:50:50 +0100 |
commit | 21a09a14181851e931f9b2b65704044eed169fb7 (patch) | |
tree | 5f586e42fa22381ec3302ed27ee77d6ff18f8fbc /Completion/Unix/Type/_file_modes | |
parent | c789efbaf0db016256d58c685c5586d7a684170d (diff) | |
download | zsh-21a09a14181851e931f9b2b65704044eed169fb7.tar.gz zsh-21a09a14181851e931f9b2b65704044eed169fb7.tar.xz zsh-21a09a14181851e931f9b2b65704044eed169fb7.zip |
42214: use less general names on new functions for completing file flags and modes
Diffstat (limited to 'Completion/Unix/Type/_file_modes')
-rw-r--r-- | Completion/Unix/Type/_file_modes | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/Completion/Unix/Type/_file_modes b/Completion/Unix/Type/_file_modes new file mode 100644 index 000000000..fbe4c9363 --- /dev/null +++ b/Completion/Unix/Type/_file_modes @@ -0,0 +1,37 @@ +#autoload + +# Provides completion for file modes (formerly part of _chmod) + +local curcontext=$curcontext +local -a context line state state_descr copts=( "${@}" ) privs +local -A val_args + +privs=( + 'r[read]' 'w[write]' 'x[execute]' + 's[set uid/gid]' 't[sticky]' + 'X[execute only if directory or executable to another]' + "u[owner's current permissions]" + "g[group's current permissions]" + "o[others' current permissions]" +) + +[[ $OSTYPE == solaris* ]] && +privs+=( 'l[mandatory locking]' ) + +compset -P '*,' +compset -S ',*' + +if [[ -prefix [0-7] ]]; then + _message -e number 'numeric mode' +elif compset -P '[a-z]#[+-=]'; then + _values -O copts -S '' privilege $privs && return 0 +else + compset -P '*' + copts=( -S '' ) + _alternative -O copts \ + 'who:who:((a\:all u\:owner g\:group o\:others))' \ + 'operators:operator:(+ - =)' \ + && return 0 +fi + +return 1 |