zsh-workers
 help / color / mirror / code / Atom feed
e11cd226c1e08787cbc16dea25f2674846937ffa blob 1683 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
 
#compdef lua -P lua[0-9.-]##

# Complete lua library names. We go out of our way here to support sub-modules
# (of the format foo.bar.baz), even though the way `lua -l` handles those isn't
# very nice, because it might be useful for informational purposes
(( $+functions[_lua_libraries] )) ||
_lua_libraries() {
  local p
  local -a tmp tmp2 pre

  # Lua will tell us its effective search paths in the error message
  tmp=( ${(f)"$( _call_program libraries $words[1] -l '"%%FAKE%%"' 2>&1 )"} )

  [[ $tmp == *'%%FAKE%%'* ]] && {
    tmp=( ${(@M)tmp:#*no file*'%%FAKE%%'*} )
    tmp=( ${(@)tmp##[[:space:]]#no file[[:space:]\'\"]##} )
    tmp=( ${(@)tmp%%[[:space:]\'\"]##} )

    for p in $tmp; do
      pre+=( ${(b)p%%'%%FAKE%%'*} )
      # Don't recurse infinitely into the current directory; we'll just trust
      # that all other paths are sensible
      if [[ $p == './%%FAKE%%'* ]]; then
        tmp2+=( ${~${${(b)p}/'%%FAKE%%'/'*'}}(#qN) )
      else
        tmp2+=( ${~${${(b)p}/'%%FAKE%%'/'**/*'}}(#qN) )
      fi
    done

    tmp=( $tmp2 )
    tmp=( ${(@)tmp%%(.lua|/init.lua|.so)} )
    tmp=( ${(@)tmp##(${~${(j<|>)pre}})} )
    tmp=( ${(@u)${(@)tmp//\//.}} )
  }

  _wanted -x libraries expl 'Lua library' compadd -a "$@" - tmp
}

# Stacking not supported, no arguments are exclusive except `-`
_arguments -S -A '-*' : \
  '*-e+[execute specified command string]:command string' \
  '-E[ignore environment variables]' \
  '-i[enter interactive mode]' \
  '*-l+[specify library or module to require]: :_lua_libraries' \
  '-v[display version information]' \
  '(1 -)-[stop argument parsing and execute script on stdin]' \
  '1:Lua script:_files' \
  '*:script argument'
debug log:

solving e11cd226c ...
found e11cd226c in https://inbox.vuxu.org/zsh-workers/84B28497-6E79-439D-BFB5-CDD32D6BECB5@dana.is/

applying [1/1] https://inbox.vuxu.org/zsh-workers/84B28497-6E79-439D-BFB5-CDD32D6BECB5@dana.is/
diff --git a/Completion/Unix/Command/_lua b/Completion/Unix/Command/_lua
new file mode 100644
index 000000000..e11cd226c

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

index at:
100644 e11cd226c1e08787cbc16dea25f2674846937ffa	Completion/Unix/Command/_lua

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