summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrederik “Freso” S. Olesen2024-04-29 01:15:30 +0200
committerFrederik “Freso” S. Olesen2024-04-29 01:15:30 +0200
commitfb351707abd88597d6ef317d13895bea778023d2 (patch)
tree02163443d260db9a547db360dd8990a35fff3d14
parent0bbdf6d1f754a536aca84b7ad45f3ac6bb0901f8 (diff)
downloadaur-twitch-dl.tar.gz
Generate and install shell completion files
Reference: https://twitch-dl.bezdomni.net/shell_completion.html https://click.palletsprojects.com/en/8.1.x/shell-completion/#enabling-completion
-rw-r--r--.SRCINFO2
-rw-r--r--PKGBUILD16
2 files changed, 16 insertions, 2 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 2f6731577557..b5f9efdba591 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,7 +1,7 @@
pkgbase = twitch-dl
pkgdesc = Twitch video downloader that use multiple concurrent connections
pkgver = 2.3.0
- pkgrel = 7
+ pkgrel = 8
url = https://github.com/ihabunek/twitch-dl
arch = any
license = GPL3
diff --git a/PKGBUILD b/PKGBUILD
index 1965ff8482c3..ee887718789c 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -3,7 +3,7 @@
pkgname=twitch-dl
pkgver=2.3.0
-pkgrel=7
+pkgrel=8
pkgdesc="Twitch video downloader that use multiple concurrent connections"
arch=('any')
url="https://github.com/ihabunek/twitch-dl"
@@ -42,6 +42,17 @@ build() {
export PYTHONPATH="$PWD/build/lib"
make man docs
+
+ # Make ad hoc `twitch-dl` script
+ echo '#!'$(which python) > twitch-dl
+ cat build/lib/twitchdl/__main__.py >> twitch-dl
+ chmod +x twitch-dl
+
+ # Generate completion files
+ _shells=(bash fish zsh)
+ for _shell in "${_shells[@]}"; do
+ _TWITCH_DL_COMPLETE="${_shell}_source" ./twitch-dl > "$pkgname.${_shell}"
+ done
}
check() {
@@ -56,4 +67,7 @@ package() {
install -Dm644 twitch-dl.1.man "$pkgdir"/usr/share/man/man1/twitch-dl.1
install -Dm644 -t "$pkgdir"/usr/share/doc/"$pkgname" {CHANGELOG,TODO,README}.md
mv book "$pkgdir"/usr/share/doc/"$pkgname"/
+ install -Dm644 -t "$pkgdir"/usr/share/fish/vendor_completions.d "$pkgname".fish
+ install -Dm644 -T "$pkgname".bash "$pkgdir"/usr/share/bash-completion/completions/"$pkgname"
+ install -Dm644 -T "$pkgname".zsh "$pkgdir"/usr/share/zsh/site-functions/_"$pkgname"
}