summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 0e876f1f12315f9e8d5a354ee6670a2810b1a6b0 (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
# Maintainer: Kamil ƚliwak <cameel2@gmail.com>

pkgname=ansible-completion-git
pkgver=r67.40053ed
pkgrel=1
pkgdesc='Basic bash completion for Ansible'
arch=('any')
url="https://github.com/dysosmus/ansible-completion"
license=('GPL3')
depends=('bash-completion' 'ansible')
makedepends=('git')
provides=('ansible-completion')
conflicts=('ansible-completion')
source=("$pkgname"::git+${url}.git)
sha256sums=('SKIP')

pkgver() {
    cd "${pkgname}"

    # TODO: Right now there are no tags in the git repo.
    # Change the command below to use tags when the first official version gets released.
    printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

package() {
    cd "${pkgname}"

    mkdir --parents "${pkgdir}/usr/share/bash-completion/completions/"
    for file in *-completion.bash; do
        # Completion files are loaded on demand and their names must match command names.
        # We have to strip the `-completion.bash` suffix to get the command name.
        command_name=${file/-completion.bash/}

        install -Dm644 "${file}" "${pkgdir}/usr/share/bash-completion/completions/${command_name}"
    done
}