[PATCH] Bash 3.x completion support

Graham Lyons graham at grahamlyons.com
Fri Sep 8 13:15:42 CEST 2017


Hello,

I'm using password-store on OSX (latest, 10.12.6) which comes with Bash
version 3.2.57. I get errors when using the completion as the `compopt`
command doesn't exist before Bash 4. Avoiding use of `compopt` still seems
to allow the completion to work (I'm guessing there's something missing) so
I've prepared a patch which tests for its existence first.

I hope this is in the right format - let me know if there are any problems.

Thanks,
Graham

diff --git a/src/completion/pass.bash-completion
b/src/completion/pass.bash-completion
index 456485b..cb50010 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
 }

@@ -88,7 +88,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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.zx2c4.com/pipermail/password-store/attachments/20170908/7c18821c/attachment.html>


More information about the Password-Store mailing list