~shulhan/awwan

61c31da5b6a84ae1d0857b8e676e5683b8f8c245 — Shulhan 5 months ago d18a8ee
all: add bash completion script

While at it, set the AUR architecture to 'any' since Go can be build
on all ArchLinux supported architecture; and update the url variable
to official awwan website.

References: https://todo.sr.ht/~shulhan/awwan/10
5 files changed, 77 insertions(+), 19 deletions(-)

M .gitignore
M _AUR/.SRCINFO
A _AUR/.gitignore
M _AUR/PKGBUILD
A _sys/usr/share/bash-completion/completions/awwan
M .gitignore => .gitignore +0 -5
@@ 3,11 3,6 @@
/.cache
/CHANGELOG.html
/README.html
/_AUR/*.tar.zst
/_AUR/awwan-git
/_AUR/pkg
/_AUR/src
/_AUR/wui
/_doc/*.html
/_example/.cache
/_mkosi/awwan-test

M _AUR/.SRCINFO => _AUR/.SRCINFO +3 -3
@@ 1,9 1,9 @@
pkgbase = awwan-git
	pkgdesc = Configuration management software, infrastructure as file and directory layout.
	pkgver = 0.10.0.r0.gf30f148
	pkgver = 0.11.0.r2.g5e4e1d7
	pkgrel = 1
	url = https://git.sr.ht/~shulhan/awwan
	arch = x86_64
	url = https://awwan.org
	arch = any
	license = GPL3
	makedepends = go
	makedepends = git

A _AUR/.gitignore => _AUR/.gitignore +7 -0
@@ 0,0 1,7 @@
/*.tar.zst
/awwan-git
/awwan-git-local
/pkg
/src
/wui
/wui-local

M _AUR/PKGBUILD => _AUR/PKGBUILD +18 -11
@@ 1,12 1,12 @@
# Maintainer: shulhan <ms@kilabit.info>

pkgname=awwan-git
pkgver=0.10.0.r0.gf30f148
pkgver=0.11.0.r2.g5e4e1d7
pkgrel=1

pkgdesc="Configuration management software, infrastructure as file and directory layout."
arch=(x86_64)
url='https://git.sr.ht/~shulhan/awwan'
pkgdesc='Configuration management software, infrastructure as file and directory layout.'
arch=('any')
url='https://awwan.org'
license=('GPL3')

makedepends=(


@@ 16,8 16,13 @@ makedepends=(

provides=('awwan')

## For testing in local.
#source=(
#	"${pkgname}-local::git+file:///home/ms/go/src/git.sr.ht/~shulhan/awwan#branch=dev"
#	"wui-local::git+file:///home/ms/src/wui"
#)
source=(
	"$pkgname::git+https://git.sr.ht/~shulhan/awwan"
	"${pkgname}::git+https://git.sr.ht/~shulhan/awwan"
	"wui::git+https://git.sr.ht/~shulhan/wui"
)
md5sums=(


@@ 26,24 31,26 @@ md5sums=(
)

pkgver() {
	cd "$pkgname"
	cd "${pkgname}"
	git describe --long --tags | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g'
}

prepare() {
	cd "$pkgname"
	cd "${pkgname}"
	git submodule init
	git config submodule."submodules/wui".url "${srcdir}/wui"
	git submodule update
}

build() {
	cd "$pkgname"
	cd "${pkgname}"
	make build
}

package() {
	cd "$pkgname"
	install -Dm755 _bin/awwan $pkgdir/usr/bin/awwan
	install -Dm755 COPYING $pkgdir/usr/share/licenses/awwan/COPYING
	cd "${pkgname}"
	install -Dm755 _bin/awwan "${pkgdir}/usr/bin/awwan"
	install -Dm755 COPYING    "${pkgdir}/usr/share/licenses/awwan/COPYING"
	install -Dm644 _sys/usr/share/bash-completion/completions/awwan \
		 "${pkgdir}/usr/share/bash-completion/completions/awwan"
}

A _sys/usr/share/bash-completion/completions/awwan => _sys/usr/share/bash-completion/completions/awwan +49 -0
@@ 0,0 1,49 @@
#/usr/bin/env bash
## SPDX-FileCopyrightText: 2024 Shulhan <ms@kilabit.info>
## SPDX-License-Identifier: GPL-3.0-or-later

_awwan_completions()
{
	local commands=("decrypt" "encrypt" "env-get" "env-set" "help"
		"local" "play" "serve" "version")

	local len=${#COMP_WORDS[@]}
	local cmd=${COMP_WORDS[1]}
	local key=${COMP_WORDS[2]}

	case "$cmd" in
		decrypt)
			COMPREPLY=($(compgen -A file -X "?(.git|*.log)" -- "$key"))
			;;
		encrypt)
			COMPREPLY=($(compgen -A file -X "?(.git|*.log)" -- "$key"))
			;;
		env-get)
			;;
		env-set)
			;;
		help)
			;;
		local)
			COMPREPLY=($(compgen -A file -X "?(*.log|.*)" -- "$key"))
			;;
		play)
			COMPREPLY=($(compgen -A file -X "?(*.log|.*)" -- "$key"))
			;;
		serve)
			COMPREPLY=($(compgen -A directory -- "$key"))
			;;
		version)
			;;
		*)
			if [[ -z $cmd ]]; then
				COMPREPLY=("${commands[@]}")
			else
				local list="${commands[@]}"
				COMPREPLY=($(compgen -W "$list" -- "$cmd"))
			fi
			;;
	esac
}

complete -o bashdefault -F _awwan_completions awwan