feat: zsh completions

This commit is contained in:
2026-04-01 12:34:54 +02:00
parent 00f4bbb5f0
commit b29a5274e1
5 changed files with 31 additions and 0 deletions

View File

@@ -1,5 +1,6 @@
PREFIX ?= /usr/local PREFIX ?= /usr/local
BINDIR = $(PREFIX)/bin BINDIR = $(PREFIX)/bin
ZSHCOMPDIR ?= $(PREFIX)/share/zsh/site-functions
all: kewt all: kewt
@@ -9,9 +10,12 @@ kewt:
install: kewt install: kewt
install -d $(DESTDIR)$(BINDIR) install -d $(DESTDIR)$(BINDIR)
install -m 755 kewt $(DESTDIR)$(BINDIR)/kewt install -m 755 kewt $(DESTDIR)$(BINDIR)/kewt
install -d $(DESTDIR)$(ZSHCOMPDIR)
install -m 644 packaging/zsh/_kewt $(DESTDIR)$(ZSHCOMPDIR)/_kewt
uninstall: uninstall:
rm -f $(DESTDIR)$(BINDIR)/kewt rm -f $(DESTDIR)$(BINDIR)/kewt
rm -f $(DESTDIR)$(ZSHCOMPDIR)/_kewt
clean: clean:
rm -f kewt rm -f kewt

View File

@@ -26,4 +26,6 @@ build() {
package() { package() {
cd "${pkgname}" cd "${pkgname}"
install -Dm755 kewt "${pkgdir}/usr/bin/kewt" install -Dm755 kewt "${pkgdir}/usr/bin/kewt"
install -d "${pkgdir}/usr/share/zsh/site-functions"
"${pkgdir}/usr/bin/kewt" --dump-zsh-completions > "${pkgdir}/usr/share/zsh/site-functions/_kewt"
} }

View File

@@ -18,4 +18,6 @@ build() {
package() { package() {
install -Dm755 "${srcdir}/${pkgname}-${pkgver}.sh" "${pkgdir}/usr/bin/kewt" install -Dm755 "${srcdir}/${pkgname}-${pkgver}.sh" "${pkgdir}/usr/bin/kewt"
install -d "${pkgdir}/usr/share/zsh/site-functions"
"${pkgdir}/usr/bin/kewt" --dump-zsh-completions > "${pkgdir}/usr/share/zsh/site-functions/_kewt"
} }

View File

@@ -8,6 +8,7 @@ class Kewt < Formula
def install def install
bin.install "kewt" bin.install "kewt"
generate_completions_from_executable(bin/"kewt", "--dump-zsh-completions", shells: [:zsh])
end end
test do test do

22
packaging/zsh/_kewt Normal file
View File

@@ -0,0 +1,22 @@
#compdef kewt
_kewt() {
local -a args
args=(
'--help[Show help message]'
'(-h)--help[Show help message]'
'(-)--new[Create a new site directory]'
'(-)--update[Update site.conf and template.html with latest defaults]'
'(-)--post[Create a new empty post file in the configured posts_dir]'
'(-)--generate-template[Generate a new template file]'
'(-v --version)'{-v,--version}'[Show version information]'
'--from[Source directory]:directory:_directories'
'--to[Output directory]:directory:_directories'
'(-w --watch)'{-w,--watch}'[Watch for file changes and rebuild automatically]'
'(-s --serve)'{-s,--serve}'[Start a local HTTP server after building]::port:'
)
_arguments -S -C $args '*: :_directories'
}
_kewt "$@"