chore(main/hcloud): Install shell completion (#19892)

This commit is contained in:
Biswapriyo Nath 2024-04-22 20:45:16 +05:30 committed by GitHub
parent a24d15f05d
commit 3ecb71ae99
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 15 additions and 1 deletions

View File

@ -19,9 +19,23 @@ termux_step_pre_configure() {
termux_step_make() {
# Below are taken from github.com/hetznercloud/cli@v1.30.1/.goreleaser.yml
local LD_FLAGS="-s -w -X 'github.com/hetznercloud/cli/internal/version.Version=v${TERMUX_PKG_VERSION}'"
go build -ldflags "${LD_FLAGS}" -o hcloud cmd/hcloud/main.go
export GOFLAGS="-buildmode=pie -trimpath -mod=readonly -modcacherw"
go build -ldflags "${LD_FLAGS}" -o hcloud cmd/hcloud/main.go
}
termux_step_make_install() {
install -Dm700 -t $TERMUX_PREFIX/bin hcloud
install -Dm644 /dev/null "$TERMUX_PREFIX"/share/bash-completion/completions/hcloud
install -Dm644 /dev/null "$TERMUX_PREFIX"/share/zsh/site-functions/_hcloud
install -Dm644 /dev/null "$TERMUX_PREFIX"/share/fish/vendor_completions.d/hcloud.fish
}
termux_step_create_debscripts() {
cat <<-EOF >./postinst
#!${TERMUX_PREFIX}/bin/sh
hcloud completion bash > ${TERMUX_PREFIX}/share/bash-completion/completions/hcloud
hcloud completion zsh > ${TERMUX_PREFIX}/share/zsh/site-functions/_hcloud
hcloud completion fish > ${TERMUX_PREFIX}/share/fish/vendor_completions.d/hcloud.fish
EOF
}