From 77446d1ab8d213a973ab5a725f7a618c7fedbb86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakobus=20Sch=C3=BCrz?= Date: Tue, 21 Feb 2023 02:20:44 +0100 Subject: [PATCH] source completion for pass only, if it exists --- bash_completion.d/pass | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/bash_completion.d/pass b/bash_completion.d/pass index d0ef519..b889762 100644 --- a/bash_completion.d/pass +++ b/bash_completion.d/pass @@ -1,12 +1,16 @@ -#!/bin/bash -source /usr/share/bash-completion/completions/pass +#/usr/share/bash-completion/completions/pass!/bin/bash +loginfo "does pass exist? $(whereis pass)" +if [ -e /usr/share/bash-completion/completions/pass ] +then + source /usr/share/bash-completion/completions/pass -function _passbmi(){ - PASSWORD_STORE_DIR=~/.password-store/bmi/ _pass -} -complete -o filenames -o nospace -F _passbmi passbmi + function _passbmi(){ + PASSWORD_STORE_DIR=~/.password-store/bmi/ _pass + } + complete -o filenames -o nospace -F _passbmi passbmi -function _passebcont(){ - PASSWORD_STORE_DIR=~/.password-store/ebcont/ _pass -} -complete -o filenames -o nospace -F _passebcont passebcont + function _passebcont(){ + PASSWORD_STORE_DIR=~/.password-store/ebcont/ _pass + } + complete -o filenames -o nospace -F _passebcont passebcont +fi