From dea7e1d431f1700c2515ece47b07ba472e1f999c Mon Sep 17 00:00:00 2001 From: Koichi Murase Date: Mon, 18 Sep 2023 20:05:15 +0900 Subject: [PATCH] feat(nvm): add fallback 3rd-party completion loader MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://github.com/nvm-sh/nvm https://github.com/nvm-sh/nvm/blob/1eaaada4994ab26ce5f0c591996344b330066cce/README.md#bash-completion https://github.com/ohmybash/oh-my-bash/blob/b4a2264496e14f883101ec15e35607b2e7386acc/completions/nvm.completion.sh Co-authored-by: Ville Skyttä --- completions/Makefile.am | 1 + completions/_nvm | 8 ++++++++ test/fallback/completions/Makefile.am | 1 + test/fallback/completions/nvm | 1 + 4 files changed, 11 insertions(+) create mode 100644 completions/_nvm create mode 120000 test/fallback/completions/nvm diff --git a/completions/Makefile.am b/completions/Makefile.am index 60c2ee406ca..273e4d1bff9 100644 --- a/completions/Makefile.am +++ b/completions/Makefile.am @@ -299,6 +299,7 @@ bashcomp_DATA = 2to3 \ nslookup \ nsupdate \ ntpdate \ + _nvm \ oggdec \ openssl \ opera \ diff --git a/completions/_nvm b/completions/_nvm new file mode 100644 index 00000000000..e5c2a4649c0 --- /dev/null +++ b/completions/_nvm @@ -0,0 +1,8 @@ +# 3rd party completion loader for nvm -*- shell-script -*- +# +# This serves as a fallback in case the completion is not installed otherwise. + +# shellcheck disable=SC1091 +[[ ${NVM_DIR-} && -r $NVM_DIR/bash_completion ]] && . "$NVM_DIR"/bash_completion + +# ex: filetype=sh diff --git a/test/fallback/completions/Makefile.am b/test/fallback/completions/Makefile.am index 92eb194ae63..f6ac46bde0b 100644 --- a/test/fallback/completions/Makefile.am +++ b/test/fallback/completions/Makefile.am @@ -24,6 +24,7 @@ EXTRA_DIST = \ newgrp \ nmcli \ nox \ + nvm \ pip \ pipenv \ renice \ diff --git a/test/fallback/completions/nvm b/test/fallback/completions/nvm new file mode 120000 index 00000000000..bcaccbb3eca --- /dev/null +++ b/test/fallback/completions/nvm @@ -0,0 +1 @@ +../../../completions/_nvm \ No newline at end of file