From 499ecab89f90e5006f3137e3094ec1c6a1977164 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Sat, 12 Oct 2024 10:59:56 +0300 Subject: [PATCH] feat(uvx): add 3rd party fallback completion loader https://docs.astral.sh/uv/getting-started/installation/#shell-autocompletion --- completions/Makefile.am | 1 + completions/_uvx | 8 ++++++++ test/fallback/completions/Makefile.am | 1 + test/fallback/completions/uvx | 1 + 4 files changed, 11 insertions(+) create mode 100644 completions/_uvx create mode 120000 test/fallback/completions/uvx diff --git a/completions/Makefile.am b/completions/Makefile.am index 0da13468de5..bf392161f96 100644 --- a/completions/Makefile.am +++ b/completions/Makefile.am @@ -455,6 +455,7 @@ bashcomp_DATA = 2to3 \ useradd \ userdel \ usermod \ + _uvx \ valgrind \ _vault \ vipw \ diff --git a/completions/_uvx b/completions/_uvx new file mode 100644 index 00000000000..f08d3f66baf --- /dev/null +++ b/completions/_uvx @@ -0,0 +1,8 @@ +# 3rd party completion loader for commands emitting -*- shell-script -*- +# their completion using "$cmd --generate-shell-completion bash". +# +# This serves as a fallback in case the completion is not installed otherwise. + +eval -- "$("$1" --generate-shell-completion bash 2>/dev/null)" + +# ex: filetype=sh diff --git a/test/fallback/completions/Makefile.am b/test/fallback/completions/Makefile.am index 160cdd58d4b..c8057f0f5e0 100644 --- a/test/fallback/completions/Makefile.am +++ b/test/fallback/completions/Makefile.am @@ -47,6 +47,7 @@ EXTRA_DIST = \ udevadm \ umount \ umount.linux \ + uvx \ vault \ write \ xm \ diff --git a/test/fallback/completions/uvx b/test/fallback/completions/uvx new file mode 120000 index 00000000000..ae2e60b1d70 --- /dev/null +++ b/test/fallback/completions/uvx @@ -0,0 +1 @@ +../../../completions/_uvx \ No newline at end of file