diff options
author | Axel Beckert <abe@deuxchevaux.org> | 2015-11-25 18:51:00 +0100 |
---|---|---|
committer | Axel Beckert <abe@deuxchevaux.org> | 2015-11-25 18:51:00 +0100 |
commit | 317ec32cb1cbd15b31e17bcb07f09c52cd37c44a (patch) | |
tree | 88a02c853dfafd82a2d551d862d8dfb056b1bee6 /Completion/Unix/Command/_tr | |
parent | 1637291aaea12ddcfd549d50d49c480185995c1a (diff) | |
parent | cce4261a3c6f4bf78b483db61623c80e3c98d10b (diff) | |
download | zsh-317ec32cb1cbd15b31e17bcb07f09c52cd37c44a.tar.gz zsh-317ec32cb1cbd15b31e17bcb07f09c52cd37c44a.zip |
Merge tag 'zsh-5.1.1-test-1' into debian
Diffstat (limited to 'Completion/Unix/Command/_tr')
-rw-r--r-- | Completion/Unix/Command/_tr | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/Completion/Unix/Command/_tr b/Completion/Unix/Command/_tr new file mode 100644 index 000000000..d55fab5ff --- /dev/null +++ b/Completion/Unix/Command/_tr @@ -0,0 +1,53 @@ +#compdef tr + +local curcontext="$curcontext" state line expl ret=1 +local args variant +local -A descr +descr=( + -c '[complement characters specified by first string]' + -d '[delete specified characters from input]' + -s '[squeeze repeated instances of character to a single instance]' +) + +_pick_variant -r variant gnu=GNU $OSTYPE --version +case $variant in + gnu) + args=( + '(-c -C --complement)'{-c,-C,--complement}"${descr[-c]}" + '(-d --delete 2)'{-d,--delete}"${descr[-d]}" + '(-s --squeeze-repeats)'{-s,--squeeze-repeats}"${descr[-s]}" + '(- 1 2)--help[display help information]' + '(- 1 2)--version[display version information]' + ) + ;; + darwin*|dragonfly*|*bsd*) + args+=( "(-c)-C$descr[-c]" ) + ;| + darwin*|dragonfly*|freebsd*) + args+=( '-u[guarantee that output is unbuffered]' ) + ;| + *) + for k in c d s; do + args+=( -$k$descr[$k] ) + done + ;; +esac + +_arguments -C -s $args \ + '1:character set:->chsets' \ + '2:character set:->chsets' && ret=0 + +if [[ -n $state ]]; then + if compset -P '*\[:'; then + _wanted characters expl 'character class' \ + compadd -S ":${${QIPREFIX:+]}:-\]}$compstate[quote] " \ + alnum alpha blank cntrl digit graph lower print punct space upper \ + xdigit && return + elif compset -P '*\\'; then + _describe -t characters character \ + '(\\\\:backslash a:alert b:backspace f:form\ feed n:new\ line r:return t:tab v:vertical\ tab)' -S '' && return + fi + _message -e characters 'character set' +fi + +return ret |