zsh-workers
 help / color / mirror / code / Atom feed
3138023ab41cb32562386319be8f3367c0cbf3aa blob 2292 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
 
#compdef virsh

_libvirt () {
  local curcontext="$curcontext" state line expl ret=1

  case $service in
  virsh)
    if (( ! $+_cache_virsh_cmds )); then
      _cache_virsh_cmds=( ${="$(_call_program virsh virsh help 2>&1 | awk '!/:/ {print $1}')"} )
    fi
    if (( ! $+_cache_virsh_cmdopts )); then
      typeset -gA _cache_virsh_cmdopts
    fi
    _arguments -A "-*" -C -S -s -w \
      '(- *)'{-h,--help}'[print help information and exit]' \
      '(- *)'{-v,--version=short}'[print short version information and exit]' \
      '(- *)'{-V,--version=long}'[print long version information and exit]' \
      '(-c --connect)'{-c+,--connect}'[specify connection URI]:URI:_hosts' \
      '(-d --debug)'{-d+,--debug}'[set debug level]:level:(0 1 2 3 4)' \
      '(-e --escape)'{-e+,--escape}'[set escape sequence for console]:sequence' \
      '(-k --keepalive-interval)'{-k+,--keepalive-interval}'[set keepalive interval]:interval' \
      '(-K --keepalive-count)'{-K+,--keepalive-count}'[set keepalive count]:count' \
      '(-l --log)'{-l+,--log}'[specify log file]:file:_files' \
      '(-q --quiet)'{-q,--quiet}'[quiet mode]' \
      '(-r --readonly)'{-r,--readonly}'[connect readonly]' \
      '(-t --timing)'{-t,--timing}'[print timing information]' \
      '1:command:->virsh_cmds' \
      '*:cmdopt:->virsh_cmdopts' \
      && return 0
      # We accept only virsh command options after the first non-option argument
      # (i.e., the virsh command itself), this makes it so with the -A "-*" above
      [[ -z $state ]] && state=virsh_cmdopts
  ;;
  esac

  case $state in
    virsh_cmds)
      _wanted commands expl 'virsh command' compadd -a _cache_virsh_cmds && ret=0
    ;;
    virsh_cmdopts)
      local cmd
      if [[ $words[-1] == /* || $words[-1] == ./* ]]; then
        _default && return 0
      fi
      for (( i = 2; i <= $#words; i++ )); do
        [[ -n "${_cache_virsh_cmds[(r)$words[$i]]}" ]] && cmd=$words[$i] && break
      done
      [[ -z $cmd ]] && return 1
      if [[ -z $_cache_virsh_cmdopts[$cmd] ]]; then
        _cache_virsh_cmdopts[$cmd]=${(M)${${${${=${(f)"$(_call_program virsh virsh help $cmd 2>&1)"}}/\[}/\]}/\;}:#-[-0-9A-Za-z]*}
      fi
      _values -w options ${=_cache_virsh_cmdopts[$cmd]} && ret=0
    ;;
  esac

  return ret
}

_libvirt "$@"
debug log:

solving ac19ac3 ...
found ac19ac3 in https://inbox.vuxu.org/zsh-workers/9290c558-6f43-fbbe-9900-afa4cda14c16@redhat.com/

applying [1/1] https://inbox.vuxu.org/zsh-workers/9290c558-6f43-fbbe-9900-afa4cda14c16@redhat.com/
diff --git a/Completion/Unix/Command/_libvirt b/Completion/Unix/Command/_libvirt
new file mode 100644
index 0000000..ac19ac3

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

index at:
100644 3138023ab41cb32562386319be8f3367c0cbf3aa	Completion/Unix/Command/_libvirt

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