cli: add shell completions
This commit is contained in:
parent
28bbdf9774
commit
d310048f7d
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -6,6 +6,7 @@
|
||||||
__pycache__
|
__pycache__
|
||||||
*.pyo
|
*.pyo
|
||||||
|
|
||||||
|
completions
|
||||||
docs/_build
|
docs/_build
|
||||||
docs/api
|
docs/api
|
||||||
dist
|
dist
|
||||||
|
|
56
Makefile
Normal file
56
Makefile
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
# SPDX-License-Identifier: WTFPL
|
||||||
|
# SPDX-FileCopyrightText: 2024 Anna <cyber@sysrq.in>
|
||||||
|
# No warranty
|
||||||
|
|
||||||
|
PROG = find-work
|
||||||
|
|
||||||
|
PREFIX ?= /usr/local
|
||||||
|
MANDIR ?= $(PREFIX)/share/man
|
||||||
|
BASHCOMPDIR ?= $(PREFIX)/share/bash-completion/completions
|
||||||
|
ZSHCOMPDIR ?= $(PREFIX)/share/zsh/site-functions
|
||||||
|
FISHCOMPDIR ?= $(PREFIX)/share/fish/vendor_completions.d
|
||||||
|
|
||||||
|
INSTALL ?= install
|
||||||
|
INSTALL_DATA ?= $(INSTALL) -m 0644
|
||||||
|
|
||||||
|
help:
|
||||||
|
@echo 'usage: make [target] ...'
|
||||||
|
@echo
|
||||||
|
@echo 'suggested targets:'
|
||||||
|
@echo 'install-man - Install manpages'
|
||||||
|
@echo 'install-comp - Install shell completions'
|
||||||
|
@echo 'install-data - Shorhand for "install-man install-comp"'
|
||||||
|
|
||||||
|
install-data: install-man install-comp
|
||||||
|
|
||||||
|
install-man:
|
||||||
|
mkdir -p $(DESTDIR)$(MANDIR)/man1
|
||||||
|
$(INSTALL_DATA) man/$(PROG).1 $(DESTDIR)$(MANDIR)/man1
|
||||||
|
|
||||||
|
install-comp: install-bashcomp install-zshcomp install-fishcomp
|
||||||
|
|
||||||
|
install-bashcomp: completions/$(PROG).bash
|
||||||
|
mkdir -p $(DESTDIR)$(BASHCOMPDIR)
|
||||||
|
$(INSTALL_DATA) $< $(DESTDIR)$(BASHCOMPDIR)/$(PROG)
|
||||||
|
|
||||||
|
install-zshcomp: completions/$(PROG).zsh
|
||||||
|
mkdir -p $(DESTDIR)$(ZSHCOMPDIR)
|
||||||
|
$(INSTALL_DATA) $< $(DESTDIR)$(ZSHCOMPDIR)/_$(PROG)
|
||||||
|
|
||||||
|
install-fishcomp: completions/$(PROG).fish
|
||||||
|
mkdir -p $(DESTDIR)$(FISHCOMPDIR)
|
||||||
|
$(INSTALL_DATA) $< $(DESTDIR)$(FISHCOMPDIR)/$(PROG).fish
|
||||||
|
|
||||||
|
completions/$(PROG).bash:
|
||||||
|
mkdir -p completions
|
||||||
|
_FIND_WORK_COMPLETE=bash_source $(PROG) > $@
|
||||||
|
|
||||||
|
completions/$(PROG).zsh:
|
||||||
|
mkdir -p completions
|
||||||
|
_FIND_WORK_COMPLETE=zsh_source $(PROG) > $@
|
||||||
|
|
||||||
|
completions/$(PROG).fish:
|
||||||
|
mkdir -p completions
|
||||||
|
_FIND_WORK_COMPLETE=fish_source $(PROG) > $@
|
||||||
|
|
||||||
|
.PHONY: help install-data install-man install-comp install-bashcomp install-zshcomp install-fishcomp
|
|
@ -40,6 +40,12 @@ Source = "https://git.sysrq.in/find-work"
|
||||||
Issues = "https://bugs.sysrq.in/enter_bug.cgi?product=Software&component=find-work"
|
Issues = "https://bugs.sysrq.in/enter_bug.cgi?product=Software&component=find-work"
|
||||||
Changelog = "https://find-work.sysrq.in/release-notes.html"
|
Changelog = "https://find-work.sysrq.in/release-notes.html"
|
||||||
|
|
||||||
|
[tool.flit.sdist]
|
||||||
|
include = [
|
||||||
|
"Makefile",
|
||||||
|
"man/",
|
||||||
|
]
|
||||||
|
|
||||||
[tool.mypy]
|
[tool.mypy]
|
||||||
disallow_untyped_defs = true
|
disallow_untyped_defs = true
|
||||||
no_implicit_optional = true
|
no_implicit_optional = true
|
||||||
|
|
Loading…
Reference in New Issue
Block a user