dev-python/typer: generate shell completions in src_compile
This commit is contained in:
parent
91aa52ab55
commit
081756569b
|
@ -36,6 +36,8 @@ RDEPEND="
|
|||
')
|
||||
"
|
||||
|
||||
COMPLETIONSDIR="${WORKDIR}/comp"
|
||||
|
||||
distutils_enable_tests pytest
|
||||
|
||||
src_test() {
|
||||
|
@ -45,11 +47,22 @@ src_test() {
|
|||
distutils-r1_src_test "${@}"
|
||||
}
|
||||
|
||||
src_compile() {
|
||||
distutils-r1_src_compile "${@}"
|
||||
|
||||
mkdir "${COMPLETIONSDIR}"
|
||||
|
||||
export _TYPER_COMPLETE_TEST_DISABLE_SHELL_DETECTION=1
|
||||
python -m typer --show-completion bash > "${COMPLETIONSDIR}/${PN}"
|
||||
python -m typer --show-completion zsh > "${COMPLETIONSDIR}/_${PN}"
|
||||
python -m typer --show-completion fish > "${COMPLETIONSDIR}/${PN}.fish"
|
||||
}
|
||||
|
||||
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}"
|
||||
dobashcomp "${COMPLETIONSDIR}/${PN}"
|
||||
dozshcomp "${COMPLETIONSDIR}/_${PN}"
|
||||
dofishcomp "${COMPLETIONSDIR}/${PN}.fish"
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue