[PATCH] Bash completion with elderly bash version

Alessandro Morgantini gpz500 at technologist.com
Wed Jan 9 16:28:25 CET 2019


> On 09 Jan 2019, at 15:10, Amir Yalon <quoiceehoh-20180826 at yxejamir.net> wrote:
> Looks good to me, and pretty harmless. Not sure if it would help to get it accepted, but do note that the maintainer expects git-formatted patches. (I.e. as described here: https://git-scm.com/book/en/v2/Distributed-Git-Contributing-to-a-Project#_project_over_email)

Thank you very much Amir! I’m not yet very skilled in git ;-)… second try:

---
 src/completion/pass.bash-completion | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/completion/pass.bash-completion b/src/completion/pass.bash-completion
index 95d3e1e..a18713f 100644
--- a/src/completion/pass.bash-completion
+++ b/src/completion/pass.bash-completion
@@ -54,7 +54,7 @@ _pass_complete_entries () {
 	# The only time we want to add a space to the end is if there is only
 	# one match, and it is not a directory
 	if [[ $i -gt 1 || ( $i -eq 1 && -d $firstitem ) ]]; then
-		compopt -o nospace
+		type compopt >/dev/null 2>&1 && compopt -o nospace
 	fi
 }
 
@@ -91,7 +91,7 @@ _pass()
 			init)
 				if [[ $lastarg == "-p" || $lastarg == "--path" ]]; then
 					_pass_complete_folders
-					compopt -o nospace
+					type compopt >/dev/null 2>&1 && compopt -o nospace
 				else
 					COMPREPLY+=($(compgen -W "-p --path" -- ${cur}))
 					_pass_complete_keys
-- 
2.20.1




More information about the Password-Store mailing list