zsh-workers
 help / color / mirror / code / Atom feed
1f0fab982f4f572244e3d447929ca0f2e5ff0301 blob 1675 bytes (raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
 
#compdef head

local curcontext=$curcontext state state_descr line expl opts args ret=1
typeset -A opt_args

if _pick_variant gnu=GNU unix --version; then
  args=(
    '(-n --lines -c --bytes)'{-c+,--bytes=}'[print the first (or with -, all but the last) specified bytes]:number of bytes:->number'
    '(-n --lines -c --bytes)'{-n+,--lines=}'[print the first (or with -, all but the last) specified lines]:number of lines:->number'
    '(-q --quiet --silent -v --verbose)'{-q,--quiet,--silent}'[never print headers giving file names]'
    '(-q --quiet --silent -v --verbose)'{-v,--verbose}'[always print headers giving file names]'
    '(- *)--help[display help and exit]'
    '(- *)--version[output version information and exit]'
  )
else
  opts='-A "-*"'
  args=( '(-c)-n+[display the first specified lines]:number of lines' )
  case $OSTYPE in
    (freebsd*|darwin*|dragonfly*|netbsd*)
      args+=( '(-n)-c+[display the first specified bytes]:number of bytes' )
      ;;
  esac
fi

_arguments -C -s -S $opts : $args '*:file:_files' && return 0

case $state in
  (number)
    local mlt sign digit
    mlt='multiplier:multiplier:((b\:512 K\:1024 KB\:1000 M\:1024\^2'
    mlt+=' MB\:1000\^2 G\:1024\^3 GB\:1000\^3 T\:1024\^4 TB\:1000\^4))'
    sign='sign:sign:((-\:"print all but the last specified bytes/lines"'
    sign+=' +\:"print the first specified bytes/lines (default)"))'
    digit='digits:digit:(0 1 2 3 4 5 6 7 8 9)'
    if compset -P '*[0-9]'; then
      _alternative $mlt $digit && ret=0
    elif [[ -z $PREFIX ]]; then
      _alternative $sign $digit && ret=0
    elif compset -P '(+|-)'; then
      _alternative $digit && ret=0
    fi
    ;;
esac

return ret
debug log:

solving 1f0fab9 ...
found 1f0fab9 in https://inbox.vuxu.org/zsh-workers/B5E3ED95-7E9C-45C1-83C3-F14C383F01E6@kba.biglobe.ne.jp/

applying [1/1] https://inbox.vuxu.org/zsh-workers/B5E3ED95-7E9C-45C1-83C3-F14C383F01E6@kba.biglobe.ne.jp/
diff --git a/Completion/Unix/Command/_head b/Completion/Unix/Command/_head
new file mode 100644
index 0000000..1f0fab9

Checking patch Completion/Unix/Command/_head...
Applied patch Completion/Unix/Command/_head cleanly.

index at:
100644 1f0fab982f4f572244e3d447929ca0f2e5ff0301	Completion/Unix/Command/_head

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).