[Pull request] Use comptopt only when available

Steven Eardley steve at eardley.xyz
Mon Apr 3 20:46:06 CEST 2017


I upgraded my bash on OS X a few weeks ago because of this very issue. Thanks for looking into it!

Steve

> On 3 Apr 2017, at 11:34, Harmen Stoppels <harmenstoppels at gmail.com> wrote:
> 
> Hi,
> 
> MacOS currently has not support for `compopt`. Autocompletion is pretty annoying now:
> 
> "pass D [tab] -bash: compopt: command not found"
> 
> In Docker they have had a similar issue: https://github.com/docker/docker/pull/16492 <https://github.com/docker/docker/pull/16492>.
> 
> Below is a patch
> 
> From 1ed0edef3c87861f209e6596694291a743d15ca4 Mon Sep 17 00:00:00 2001
> From: Harmen Stoppels <harmenstoppels at gmail.com <mailto:harmenstoppels at gmail.com>>
> Date: Mon, 3 Apr 2017 11:51:54 +0200
> Subject: [PATCH] Use compopt only if available
> 
> ---
>  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 456485b..27a46e7 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
> --
> 2.12.2
> _______________________________________________
> Password-Store mailing list
> Password-Store at lists.zx2c4.com
> https://lists.zx2c4.com/mailman/listinfo/password-store

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.zx2c4.com/pipermail/password-store/attachments/20170403/686d96ca/attachment.html>


More information about the Password-Store mailing list