diff options
author | Axel Beckert <abe@deuxchevaux.org> | 2017-08-10 17:16:37 +0200 |
---|---|---|
committer | Axel Beckert <abe@deuxchevaux.org> | 2017-08-10 17:16:37 +0200 |
commit | e3b67a8198c852bf6c9db3a0a1a20e87a4e1da74 (patch) | |
tree | 8486633f6232f49ea330ab8e036decb5dc3bbf74 /Completion/Unix/Command/_fmt | |
parent | f8edeff2494bf23e2ee29d4c761361b1c878e09d (diff) | |
parent | dc475bfa0ec6cd03789dde3bf28f71e0ea9d5003 (diff) | |
download | zsh-e3b67a8198c852bf6c9db3a0a1a20e87a4e1da74.tar.gz zsh-e3b67a8198c852bf6c9db3a0a1a20e87a4e1da74.zip |
Merge tag '5.4.1' into debian
Release 5.4.1.
Diffstat (limited to 'Completion/Unix/Command/_fmt')
-rw-r--r-- | Completion/Unix/Command/_fmt | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/Completion/Unix/Command/_fmt b/Completion/Unix/Command/_fmt new file mode 100644 index 000000000..759396637 --- /dev/null +++ b/Completion/Unix/Command/_fmt @@ -0,0 +1,60 @@ +#compdef fmt + +local variant +local -a args +local copt="[preserve indentation of first two lines]" +local wopt="[specify maximum line width]:width [75]" +local sopt="[don't join short lines\: split only]" + +args=( -A "-*" "(1 2)-w+$wopt" '*:file:_files' ) +_pick_variant -r variant gnu=GNU unix --version +case $variant in + gnu) + args=( + '(-c --crown-margin)'{-c,--crown-margin}$copt + '(-w --width)'{-w+,--width=}$wopt + '(-p --prefix)'{-p+,--prefix=}'[only reformat lines with specified prefix]:prefix' + '(-s --split-only)'{-s,--split-only}$sopt + '(-t --tagged-paragraph)'{-t,--tagged-paragraph}'[indentation of first line different from second]' + '(-u --uniform-spacing)'{-u,--uniform-spacing}'[use one space between words, two after sentences]' + '(-g --goal)'{-g,--goal=}'[specify goal width]:goal width [93% of width]' + '(- *)--help[display help information]' + '(- *)--version[display version information]' + '*:file:_files' + ) + ;; + solaris*) + args=( + "-c$copt" + "-s$sopt" + ) + ;; + netbsd*) + args+=( + '-C[center the text]' + '(1 2)-g+[specify goal width]:goal width' + '(1 2)-m+[specify maximum width]:maximum width' + '-r[format all lines]' + ) + ;| + darwin*|dragonfly*|freebsd*|openbsd*) + args+=( + '-c[center the text line by line]' + '-m[sensible formatting of mail header lines]' + '-n[format lines beginning with a . (dot) character]' + "-p[change in indentation doesn't start new paragraph]" + '-s[collapse whitespace inside lines]' + '-d+[specify sentence-ending characters]:sentence ends [.?!]' + '-l+[replace initial spaces with tabs]:tab width [8]' + '-t+[specify tab width of input files]:tab width [8]' + ) + ;& # fall-through + netbsd*) + args+=( ':: :_guard "[0-9]#" goal width' ) + (( ${(M)#words[1,CURRENT-1]:#[0-9]##} )) && args+=( + ':: :_guard "[0-9]#" maximum width' + ) + ;; +esac + +_arguments -s -S $args |