zsh-workers
 help / color / mirror / code / Atom feed
6f7322412a8e723929e4054510ed42e52e130c3f blob 5474 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
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
 
#compdef fink

_fink_get_packages_with_cache(){
  local cache_policy
  zstyle -s ":completion:${curcontext}:packages" cache-policy cache_policy
  if [[ -z "$cache_policy" ]]; then
    zstyle ":completion:${curcontext}:packages" cache-policy _finkpkgs_caching_policy
  fi

  typeset -g -a _cache_fink_pkgs
  local expl

  if (( ! $+_cache_fink_pkgs[1] )) && { _cache_invalid fink-pkgs ||
      ! _retrieve_cache fink-pkgs }
  then
    _cache_fink_pkgs=(${(f)"$(
      command fink list --tab \
      | command grep -v '\[virtual package\]' \
      | command sed 's/^   / n /' \
      | command cut -f1,2
    )"})
    _store_cache fink-pkgs _cache_fink_pkgs
  fi

  if (( # > 0 )); then
    local i
    for i in "$@"; do
      case "$i" in
        -i) packages+=(${${(M)_cache_fink_pkgs:#?i?*}#*	}) ;;
        -o) packages+=(${${(M)_cache_fink_pkgs:#(i)*}#*	}) ;;
        -n) packages+=(${${(M)_cache_fink_pkgs:# n *}#*	}) ;;
      esac
    done
  else
    packages=( ${_cache_fink_pkgs#*	} )
  fi
}

_fink_get_packages_without_cache(){
  local expl

  packages=(${(f)"$(
    command fink list -t "$@" "$PREFIX" \
    | command grep -v '\[virtual package\]' \
    | command cut -f2
  )"})
}

_fink_get_packages(){
  # variable packages will be set
  if zstyle -t ":completion:${curcontext}:packages" use-cache; then
    _fink_get_packages_with_cache "$@"
  else
    _fink_get_packages_without_cache "$@"
  fi
}

_finkpkgs_caching_policy(){
  local -a oldp
  oldp=( "$1"(Nmw+1) )
  (( $#oldp )) ||
    [[ /sw/var/cache/apt/pkgcache.bin -nt "$1" ]] ||
    [[ /sw/var/lib/dpkg/available -nt "$1" ]]
}

_fink(){
  local -a _1st_arguments
  _1st_arguments=(
    'install:install or update packages'
    'remove:remove packages'
    'purge:remove packages and configuration files'
    'update-all:update all installed packages to the latest version'
    'list:search package name or conditions and list'
    'apropos:search package descriptions or conditions and list'
    'describe:display a description of the package'
    'fetch:download package source files'
    'fetch-all:downloads all package source files'
    'fetch-missing:download all missing package source files'
    'build:build .deb packages'
    'rebuild:rebuild .deb packages'
    'reinstall:reinstall packages'
    'configure:rerun the fink configuration process'
    'selfupdate:upgrade to a new fink release'
    'validate:validate files'
    'scanpackages:call dpkg-scanpackages'
    'checksums:validate the MD5 digest of all tarballs'
    'cleanup:removes obsolete package files'
  )

  local curcontext="$curcontext" state line expl
  local -A opt_args

  _arguments \
    '(-h --help)'{-h,--help}'[display help text]' \
    '(-q --quiet)'{-q,--quiet}'[causes fink to be less verbose]' \
    '(-V --version)'{-V,--version}'[display version information]' \
    '(-v --verbose)'{-v,--verbose}'[causes fink to be more verbose]' \
    '(-y --yes)'{-y,--yes}'[assume default answer for interactive questions]' \
    '*:: :->subcmds' && return 0

  if (( CURRENT == 1 )); then
    _describe -t commands "fink subcommand" _1st_arguments
    return
  fi

  local -a packages

  case "$words[1]" in
    install|update|enable|activate|use)
      _fink_get_packages -n -o
      _wanted packages expl 'not installed or outdated fink package' compadd -a packages ;;
    remove|disable|deactivate|unuse|delete|purge)
      _fink_get_packages -i
      _wanted packages expl 'installed package' compadd -a packages ;;
    #update-all)
    list)
      _arguments \
	'(-t --tab)'{-t,--tab}'[outputs list with tabs as field delimiter]' \
        '(-i --installed)'{-i,--installed}'[packages currently installed]' \
        '(-u --uptodate)'{-u,--uptodate}'[packages up to date]' \
        '(-o --outdate)'{-o,--outdated}'[packages newer version is available]' \
        '(-n --notinstalled)'{-n,--notinstalled}'[packages not installed]' \
	'(-b --buildonly)'{-b,--buildonly}'[packages Build Only Depends]' \
	'(-s --section)'{-s=,--section=}'[sections]:section name' \
	'(-m --maintainer)'{-m=,--maintainer=}'[maintainer]:maintainer name' \
	--tree='[tree]:tree name' \
	'(-w --width)'{-w=,--width=}'[width of display]:number or "auto"' \
	'(1 : -)'{-h,--help}'[display help text]' \
	'1: :->pkgs' && return 0

        if [[ "$state" == pkgs ]]; then
          _fink_get_packages
          _wanted packages expl 'package name hint' compadd -a packages
        fi ;;
    apropos)
      _arguments \
        '(-t --tab)'{-t,--tab}'[output the list with tabs as field delimiter]' \
        '(-w --width)'{-w=,--width=}'[width of display]:number or "auto"' \
        '(1 : -)'{-h,--help}'[display help text]' \
        '1: :->pkgs' && return

        if [[ "$state" == pkgs ]]; then
          _fink_get_packages
          _wanted packages expl 'package hint' compadd -a packages
        fi ;;
    describe|desc|description|info)
      _fink_get_packages
      _wanted packages expl 'package' compadd -a packages ;;
    #fetch)
    #fetch-all)
    fetch-missing)
      _arguments \
        '(-i --ignore-restrictive)'{-i,--ignore-restrictive}'[do not fetch packages that are "License: Restrictive"]' ;;
    #build)
    rebuild|reinstall)
      _fink_get_packages
      _wanted packages expl 'package' compadd -a packages ;;
    #configure)
    #selfupdate)
    validate|check)
      _wanted files expl 'finkinfo file' _files -g "*.info(-.)" ;;
    #scanpackages)
    #checksums)
    #cleanup)
    *) _default ;;
  esac
}

_fink "$@"
debug log:

solving 6f73224 ...
found 6f73224 in https://inbox.vuxu.org/zsh-workers/6472.1481623850@hydra.kiddle.eu/
found 04a067e in https://git.vuxu.org/mirror/zsh/
preparing index
index prepared:
100644 04a067ec19d14ad5db515514622f816f772c94ea	Completion/Darwin/Command/_fink

applying [1/1] https://inbox.vuxu.org/zsh-workers/6472.1481623850@hydra.kiddle.eu/
diff --git a/Completion/Darwin/Command/_fink b/Completion/Darwin/Command/_fink
index 04a067e..6f73224 100644

Checking patch Completion/Darwin/Command/_fink...
Applied patch Completion/Darwin/Command/_fink cleanly.

index at:
100644 6f7322412a8e723929e4054510ed42e52e130c3f	Completion/Darwin/Command/_fink

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