From 7e4cc2fb199f1c88bd9a358a157fe06327fc2b28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Mon, 1 Apr 2024 21:05:05 +0000 Subject: [PATCH] feat(rg): add fallback 3rd party completion loader https://github.com/BurntSushi/ripgrep/blob/master/FAQ.md#complete --- completions/Makefile.am | 1 + completions/_rg | 8 ++++++++ test/fallback/completions/rg | 1 + 3 files changed, 10 insertions(+) create mode 100644 completions/_rg create mode 120000 test/fallback/completions/rg diff --git a/completions/Makefile.am b/completions/Makefile.am index 8f11291b382..ed1f215ab00 100644 --- a/completions/Makefile.am +++ b/completions/Makefile.am @@ -377,6 +377,7 @@ bashcomp_DATA = 2to3 \ _reptyr \ resolvconf \ _rfkill \ + _rg \ ri \ rmlist \ rmmod \ diff --git a/completions/_rg b/completions/_rg new file mode 100644 index 00000000000..41293712bed --- /dev/null +++ b/completions/_rg @@ -0,0 +1,8 @@ +# 3rd party completion loader for commands emitting -*- shell-script -*- +# their completion using "$cmd --generate complete-bash". +# +# This serves as a fallback in case the completion is not installed otherwise. + +eval -- "$("$1" --generate complete-bash 2>/dev/null)" + +# ex: filetype=sh diff --git a/test/fallback/completions/rg b/test/fallback/completions/rg new file mode 120000 index 00000000000..cb88b041b19 --- /dev/null +++ b/test/fallback/completions/rg @@ -0,0 +1 @@ +../../../completions/_rg \ No newline at end of file