dev-python/typer: install shell completions for typer command

This commit is contained in:
odrling 2024-04-05 21:39:46 +02:00
parent 97cb2703c3
commit 91aa52ab55
No known key found for this signature in database
GPG key ID: EC907F69A27A90C5

View file

@ -6,7 +6,7 @@ EAPI=8
PYTHON_COMPAT=( python3_{10..12} )
DISTUTILS_USE_PEP517=pdm-backend
inherit distutils-r1
inherit distutils-r1 shell-completion
DESCRIPTION="Build great CLIs. Easy to code. Based on Python type hints."
HOMEPAGE="
@ -14,9 +14,7 @@ HOMEPAGE="
https://github.com/tiangolo/typer
https://pypi.org/project/typer/
"
SRC_URI="
https://github.com/tiangolo/${PN}/archive/${PV}.tar.gz
-> ${P}.gh.tar.gz"
SRC_URI="https://github.com/tiangolo/${PN}/archive/${PV}/${P}.gh.tar.gz"
LICENSE="MIT"
SLOT="0"
@ -46,3 +44,12 @@ src_test() {
distutils-r1_src_test "${@}"
}
src_install() {
distutils-r1_src_install "${@}"
export _TYPER_COMPLETE_TEST_DISABLE_SHELL_DETECTION=1
newzshcomp <(python -m typer --show-completion zsh) "_${PN}"
newfishcomp <(python -m typer --show-completion fish) "${PN}.fish"
newbashcomp <(python -m typer --show-completion bash) "${PN}"
}