From 89eb014fea3a7547881f80f45d98630429d88ec3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Christian=20Gr=C3=BCnhage?= Date: Tue, 11 Oct 2022 10:32:22 +0200 Subject: [PATCH] glab: add shell completions --- srcpkgs/glab/template | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/srcpkgs/glab/template b/srcpkgs/glab/template index b050f7bebb65..bf1842ed1229 100644 --- a/srcpkgs/glab/template +++ b/srcpkgs/glab/template @@ -1,9 +1,10 @@ # Template file for 'glab' pkgname=glab version=1.22.0 -revision=1 +revision=2 wrksrc="cli-v$version" build_style=go +build_helper=qemu go_ldflags="-X main.version=$version" go_import_path=github.com/profclems/glab go_package="${go_import_path}/cmd/glab" @@ -13,7 +14,18 @@ license="MIT" homepage="https://gitlab.com/gitlab-org/cli" distfiles="https://gitlab.com/gitlab-org/cli/-/archive/v$version/cli-v$version.tar.gz" checksum=4d9bceb6818c8bf9f681119dae3a65f1c895fa21e9da6b38e8f88d245f524e10 +_completions="bash zsh fish" + +post_build() { + local cli=$(find $GOPATH/bin -name glab) + for shell in $_completions; do + vtargetrun $cli completion $shell > "glab.${shell}" + done +} post_install() { vlicense LICENSE + for shell in $_completions; do + vcompletion "glab.${shell}" $shell glab + done }