From: Mathieu Baudier Date: Fri, 30 May 2025 07:53:58 +0000 (+0200) Subject: Add llama-cli bash completion X-Git-Url: https://git.djapps.eu/?a=commitdiff_plain;h=e6f599cf1ce62300218baa77a4609498c5fa555b;p=pkg%2Fggml%2Fsources%2Fllama.cpp Add llama-cli bash completion --- diff --git a/debian/control b/debian/control index d4e1d67c..5d6c24f3 100644 --- a/debian/control +++ b/debian/control @@ -6,6 +6,7 @@ Build-Depends: debhelper-compat (= 13), pkgconf, cmake-data, cmake, ggml-dev, libcurl4-openssl-dev, + bash-completion, dh-sequence-bash-completion, Standards-Version: 4.7.0 Vcs-Git: https://git.djapps.eu/pkg/ggml/sources/llama.cpp Vcs-Browser: https://git.djapps.eu/?p=pkg/ggml/sources/llama.cpp;a=summary diff --git a/debian/llama-cpp-tools.bash-completion b/debian/llama-cpp-tools.bash-completion new file mode 100644 index 00000000..432aa940 --- /dev/null +++ b/debian/llama-cpp-tools.bash-completion @@ -0,0 +1,3 @@ +completions/llama-cli +# completions/llama-quantize does not actually use these options +completions/llama-bench diff --git a/debian/rules b/debian/rules index f60e7520..811e1879 100755 --- a/debian/rules +++ b/debian/rules @@ -39,13 +39,23 @@ override_dh_auto_configure: override_dh_auto_install: dh_auto_install + # Generate bash completion file + LD_LIBRARY_PATH=$(install_lib_multiarch) \ + $(install_bin)/llama-cli --device none --completion-bash \ + > llama-tools-completion + sed -i '/complete -F _llama_completions .*/d' llama-tools-completion + # Move executables to libexec, so that they can load the GGML backends # and link them to bin mkdir -p $(install_libexec_multiarch)/ggml + mkdir -p completions for file in $(install_bin)/llama-*; do \ mv $$file $(install_libexec_multiarch)/ggml/$$(basename "$$file"); \ ln -s --relative -t $(install_bin) $(install_libexec_multiarch)/ggml/$$(basename "$$file"); \ + cp llama-tools-completion completions/$$(basename "$$file"); \ + echo "complete -F _llama_completions $$(basename "$$file")" >> completions/$$(basename "$$file"); \ done + override_dh_auto_test: # tests which depends on remote location are failing