zsh-workers
 help / color / mirror / code / Atom feed
003c37da3b3f786ffbfc7a67dc6f69f9d8cb3261 blob 2028 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
 
#compdef compdef

local state line expl disp curcontext="$curcontext" pat normal ret=1
local args1 args2
typeset -A opt_args

args2=()
if (( ! ${words[2,-1][(I)[^-]*]} || ${words[(I)-[kK]]} )); then
  args1=(
    -A '-*'
    '(-d)-a[make function autoloadable]'
    '(-d)-n[leave existing definitions intact]'
  )
  args2=(
     - d
      '-d[delete]:*:completed command:->ccom'
     - k
      '-k[define widget and key binding]:completion function:->cfun:style:->style:*:key'
     - K
      '-K[define multiple widgets based on function]:*::: :->multi'
  )
else
  args1=(
    '!-a' '!-n'
    '*-N[completion for named command]'
  )
fi

_arguments -C -s -S \
  "$args1[@]" \
  '*-p[completion for command matching pattern]' \
  '*-P[completion for command matching pattern]' \
  ':completion function:->cfun' \
  '*:commands:->com' \
  "$args2[@]" && ret=0

if [[ $state = multi ]]; then
  case $(( CURRENT % 3 )) in
  0) _message -e keys key
     return 1;;
  1) state=cfun;;
  2) state=style;;
  esac
fi

case $state in
  com)
    pat="${words[(I)-[pP]]}"
    normal="${words[(I)-N]}"
    if (( pat && pat > normal )); then
      _message -e patterns 'pattern'
    else
      _command_names && ret=0
    fi
  ;;
  ccom)
    _wanted commands expl 'completed command' compadd -k _comps && ret=0
  ;;
  cfun)
    typeset -aU list=( ${(k)functions[(I)_*]} )
    (( ${+list[1]} )) || list+=( ${^fpath:/.}/_(|*[^~])(:t) )
    if zstyle -T ":completion:${curcontext}:functions" prefix-hidden; then
      disp=( ${list[@]#_} )
      _wanted functions expl 'completion function' \
          compadd -d disp -a list && ret=0
    else
      _wanted functions expl 'completion function' compadd -a list && ret=0
    fi
  ;;
  style)
    _wanted widgetstyle expl 'widget style' \
        compadd -M 'r:|-=* r:|=*' \
            complete-word delete-char-or-list expand-or-complete \
            expand-or-complete-prefix list-choices menu-complete \
            menu-expand-or-complete reverse-menu-complete && ret=0
  ;;
esac

return ret
debug log:

solving 003c37da3 ...
found 003c37da3 in https://inbox.vuxu.org/zsh-workers/20180826105404.31846-1-danielsh@tarpaulin.shahaf.local2/
found 7a64da835 in https://git.vuxu.org/mirror/zsh/
preparing index
index prepared:
100644 7a64da835477fcdcf184aadac6a72401c6230596	Completion/Zsh/Command/_compdef

applying [1/1] https://inbox.vuxu.org/zsh-workers/20180826105404.31846-1-danielsh@tarpaulin.shahaf.local2/
diff --git a/Completion/Zsh/Command/_compdef b/Completion/Zsh/Command/_compdef
index 7a64da835..003c37da3 100644

Checking patch Completion/Zsh/Command/_compdef...
Applied patch Completion/Zsh/Command/_compdef cleanly.

index at:
100644 003c37da3b3f786ffbfc7a67dc6f69f9d8cb3261	Completion/Zsh/Command/_compdef

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).