summaryrefslogtreecommitdiff
blob: 4b27947b12bd2591a9660f5c047b4d24dfdc2283 (plain)
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
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

EAPI=5
inherit eutils

PNn="${PN}s"
case ${PV} in
99999999*)
	EGIT_REPO_URI="git://github.com/zsh-users/${PNn}.git"
	EGIT_PROJECT="${PN}.git"
	[ -n "${EVCS_OFFLINE}" ] || EGIT_REPACK=true
	inherit git-2
	PROPERTIES="live"
	SRC_URI=""
	KEYWORDS="";;
*)
	RESTRICT="mirror"
	inherit vcs-snapshot
	SRC_URI="http://github.com/zsh-users/${PNn}/archive/0.8.0.tar.gz -> ${PN}-${PV}.tar.gz"
	KEYWORDS="~amd64 ~x86";;
esac

DESCRIPTION="Programmable Completion for zsh (includes emerge and ebuild commands)"
HOMEPAGE="http://gentoo.org/zsh-users/zsh-completions/"
LICENSE="ZSH"
SLOT="0"
DEPEND=""

IUSE=""
declare -a COMPLETIONS FILES
COMPLETIONS=()
FILES=()
for completion in \
	'Android _adb _android _emulator' \
	'+Gentoo _baselayout _eselect _gcc-config _genlop _gentoo_packages _gentoolkit _layman _portage _portage_utils' \
	'Google _google' \
	'+Unix _logger' \
	'bumblebee _optirun' \
	'database _redis-cli _pgsql_utils' \
	'dev _choc _gradle _geany _manage.py _mvn _pear _play _symfony _thor _vagrant' \
	'disk _sdd _smartmontools _srm' \
	'distribute _fab _knife _mussh' \
	'dzen _dzen2' \
	'git _git-flow _git-pulls' \
	'haskell _cabal' \
	'id3 _id3 _id3v2' \
	'managers _brew _debuild _lein _packagekit _pactree _pkcon _port _yaourt' \
	'net _dhcpcd _mosh _socat _ssh-copy-id _vpnc _vnstat' \
	'perf _perf' \
	'perl _cpanm' \
	'python _bpython _pip _pygmentize _setup.py' \
	'ruby _bundle _cap _ditz _gas _gem _github _git-wtf _lunchy _rvm' \
	'search _ack _ag' \
	'session _attach _teamocil _tmuxinator' \
	'showoff _showoff' \
	'subtitles _language_codes _periscope _subliminal' \
	'virtualbox _virtualbox' \
	'web _coffee _docpad _gradle _heroku _jonas _jmeter _jmeter-plugins _lunar _node _nvm _sbt _scala _svm'
do	curr=${completion%% *}
	case ${curr} in
	'+'*)
		curr="+completion_${curr#'+'}";;
	*)
		curr="completion_${curr}";;
	esac
	IUSE=${IUSE}${IUSE:+ }${curr}
	COMPLETIONS+=("${curr#'+'}")
	FILES+=("${completion#* }")
done

src_prepare() {
	epatch_user
}

src_install() {
	insinto /usr/share/zsh/site-functions
	local i j ok
	for i in src/*
	do	ok=false
		for (( j=0; j<${#FILES[@]}; ++j ))
		do	case " ${FILES[${j}]} " in
			*" ${i#src/} "*)
				ok=:
				use "${COMPLETIONS[$j]}" && doins "${i}" && break;;
			esac
		done
		${ok} || {
			elog "installing unknown completion ${i#*/}"
			doins "${i}"
		}
	done
	dodoc README.md
}