[PATCH] Check if support compopt command.

superbear2013 at gmail.com superbear2013 at gmail.com
Thu Jan 20 17:37:39 UTC 2022


From: superbear <superbear2013 at gmail.com>

Fix pass -c W-bash: compopt: command not found.
---
 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 2d23cbf..a6b22a1 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 && 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 && compopt -o nospace
 				else
 					COMPREPLY+=($(compgen -W "-p --path" -- ${cur}))
 					_pass_complete_keys
-- 
2.24.3 (Apple Git-128)



More information about the Password-Store mailing list