File: _fold

package info (click to toggle)
zsh 5.9-8
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 23,856 kB
  • sloc: ansic: 108,138; sh: 6,976; makefile: 722; perl: 687; awk: 291; sed: 16
file content (24 lines) | stat: -rw-r--r-- 713 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#compdef fold gfold

local variant
local -a args

_pick_variant -r variant busybox=BusyBox gnu='Free Soft' unix --version

args=(
  '(-b --bytes)'{-b,--bytes}'[count bytes rather than columns]'
  '(: -)--help[display help information]'
  '(-s --spaces)'{-s,--spaces}'[fold on whitespace]'
  '(-w --width)'{-w+,--width=}'[specify line width]:line width (columns or bytes)'
  '(: -)--version[display version information]'
  '*: :_files'
)

# Non-GNU variants don't support long options (except BusyBox's --help)
if [[ $variant == *busybox* ]]; then # See also: _busybox
  args=( ${args:#((#s)|*\))(\*|)--^help*} )
elif [[ $variant != gnu ]]; then
  args=( ${args:#((#s)|*\))(\*|)--*} )
fi

_arguments -s -S : $args