Added ZSH completions

This commit is contained in:
Nox Sluijtman 2022-08-21 19:04:57 +02:00
parent fa11a906e0
commit 7c3be83dd0
3 changed files with 35 additions and 11 deletions

View file

@ -2,14 +2,17 @@
# Maintainer: Marty Sluijtman <marty.wanderer@disroot.org> # Maintainer: Marty Sluijtman <marty.wanderer@disroot.org>
pkgname=dice-roller pkgname=dice-roller
pkgver=0.3 pkgver=0.3
pkgrel=4 pkgrel=5
pkgdesc="A little D&D dice roller written in go" pkgdesc="A little D&D dice roller written in go"
url="https://gitlab.com/EternalWanderer/dice-roller" url="https://gitlab.com/EternalWanderer/dice-roller"
arch="all" arch="all"
license="WTFPL-2.0" license="WTFPL-2.0"
makedepends="go" makedepends="go"
subpackages="$pkgname-doc" subpackages="$pkgname-doc
source="https://alpine.voidcruiser.nl/src/dice-roller-$pkgver.tar.gz" $pkgname-zsh-completion
"
source="https://alpine.voidcruiser.nl/src/dice-roller-$pkgver.tar.gz
zsh.completion"
options="!check" options="!check"
build() { build() {
@ -18,8 +21,10 @@ build() {
package() { package() {
make install PREFIX=/usr DESTDIR="$pkgdir" make install PREFIX=/usr DESTDIR="$pkgdir"
install -D -m 644 zsh.completion "$pkgdir"/usr/share/zsh/site-functions/_$pkgname
} }
sha512sums=" sha512sums="
f7f7215622d25cc591829e1317e43e6f48a2133eec8c5004a708a1b58a3a06a736e3e187ce1c0d4b7b6eac59a60a7610289e8c4c4af543b5109f49242db7c600 dice-roller-0.3.tar.gz ffd1ff18f245e0caa21756cb403f5eaef6249ceec18dcf6b2035c37ebe8b0538e008ad7b251582c2c126f11ae1a80aa0ce5c6c51305a0bc6389a6974820f7f6c dice-roller-0.3.tar.gz
c46bff230964323b7bcfdcecb502a390df74ea779ec0f6a7ce16253453a9cf81cb280573ede8c2597d7967430fec98ef4c40f0a1104671a367500c65d35eff53 zsh.completion
" "

View file

@ -14,18 +14,16 @@ clean:
dist: clean dist: clean
mkdir -p dice-roller-$(VERSION) mkdir -p dice-roller-$(VERSION)
cp -R LICENSE Makefile README.md dice-roller.1 Colors Coin Dice $(SRC) dice-roller-$(VERSION) cp -R zsh.completion LICENSE Makefile README.md dice-roller.1 Colors Coin Dice $(SRC) dice-roller-$(VERSION)
tar -cf dice-roller-$(VERSION).tar dice-roller-$(VERSION) tar -cf dice-roller-$(VERSION).tar dice-roller-$(VERSION)
gzip dice-roller-$(VERSION).tar gzip dice-roller-$(VERSION).tar
rm -rf dice-roller-$(VERSION) rm -rf dice-roller-$(VERSION)
install: all install: all
mkdir -p $(DESTDIR)$(PREFIX)/bin install -m 0775 -d $(DESTDIR)$(PREFIX)/bin
cp -f dice-roller $(DESTDIR)$(PREFIX)/bin install -m 755 dice-roller $(DESTDIR)$(PREFIX)/bin
chmod 775 $(DESTDIR)$(PREFIX)/bin/dice-roller install -m 0775 -d $(DESTDIR)$(MANPREFIX)/man1
mkdir -p $(DESTDIR)$(MANPREFIX)/man1 install -m 644 dice-roller.1 $(DESTDIR)$(MANPREFIX)/man1
cat dice-roller.1 > $(DESTDIR)$(MANPREFIX)/man1/dice-roller.1
chmod 644 $(DESTDIR)$(MANPREFIX)/man1/dice-roller.1
uninstall: uninstall:
rm -f $(DESTDIR)$(PREFIX)/bin/dice-roller\ rm -f $(DESTDIR)$(PREFIX)/bin/dice-roller\

21
zsh.completion Normal file
View file

@ -0,0 +1,21 @@
#compdef dice dice-roller
arguments=(
'(--advantage --disadvantage --attacks)-a=[Roll a set rules multiple times]:(number of attacks)'
'(--advantage --disadvantage -a)--attacks=[Roll a set rules multiple times]:(number of attacks)'
'(--advantage --disadvantage -throws)-c=-[Specify amount of dice to cast]:(number of dice)'
'(--advantage --disadvantage -c)--throws=-[Specify amount of dice to cast]:(number of dice)'
'(--advantage --disadvantage --surfaces)-s=[Use to specify die surfaces]:(number of surfaces):(4 8 10 12 20 100)'
'(--advantage --disadvantage -s)--surfaces=[Use to specify die surfaces]:(number of surfaces):(4 8 10 12 20 100)'
'(--modifier)-m=[Add modifier to result of rolls]:(number to add)'
'(-m)--modifier=[Add modifier to result of rolls]:(number to add)'
'(--advantage -c --throws -a --attacks)--disadvantage[Roll 2d20 and take the lowest value]'
'(--disadvantage -c -a --throws --attacks)--advantage[Roll 2d20 and take the highest value]'
'(--disadvantage --advantage -a --attacks -s --surfaces -m --modifier)--coin[Toss coin, same as -s 2]'
)
_arguments : $arguments