feat: zsh completions
This commit is contained in:
4
Makefile
4
Makefile
@@ -1,5 +1,6 @@
|
||||
PREFIX ?= /usr/local
|
||||
BINDIR = $(PREFIX)/bin
|
||||
ZSHCOMPDIR ?= $(PREFIX)/share/zsh/site-functions
|
||||
|
||||
all: kewt
|
||||
|
||||
@@ -9,9 +10,12 @@ kewt:
|
||||
install: kewt
|
||||
install -d $(DESTDIR)$(BINDIR)
|
||||
install -m 755 kewt $(DESTDIR)$(BINDIR)/kewt
|
||||
install -d $(DESTDIR)$(ZSHCOMPDIR)
|
||||
install -m 644 packaging/zsh/_kewt $(DESTDIR)$(ZSHCOMPDIR)/_kewt
|
||||
|
||||
uninstall:
|
||||
rm -f $(DESTDIR)$(BINDIR)/kewt
|
||||
rm -f $(DESTDIR)$(ZSHCOMPDIR)/_kewt
|
||||
|
||||
clean:
|
||||
rm -f kewt
|
||||
|
||||
@@ -26,4 +26,6 @@ build() {
|
||||
package() {
|
||||
cd "${pkgname}"
|
||||
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"
|
||||
}
|
||||
|
||||
@@ -18,4 +18,6 @@ build() {
|
||||
|
||||
package() {
|
||||
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"
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ class Kewt < Formula
|
||||
|
||||
def install
|
||||
bin.install "kewt"
|
||||
generate_completions_from_executable(bin/"kewt", "--dump-zsh-completions", shells: [:zsh])
|
||||
end
|
||||
|
||||
test do
|
||||
|
||||
22
packaging/zsh/_kewt
Normal file
22
packaging/zsh/_kewt
Normal 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 "$@"
|
||||
Reference in New Issue
Block a user