diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2015-10-21 13:55:39 +1300 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2015-10-21 13:55:39 +1300 |
commit | e8931dff60564306a5a6370f97d7c543e5663f1e (patch) | |
tree | e798e3c1085e4e788df2d8119141f407a7feaf24 /bash/bashrc.d/pass.bash | |
parent | Switch compopt back out (diff) | |
download | dotfiles-e8931dff60564306a5a6370f97d7c543e5663f1e.tar.gz dotfiles-e8931dff60564306a5a6370f97d7c543e5663f1e.zip |
When expanding with globbing, use prefix
Rather than generating all possible completions and then filtering them
down, use the completing word as a prefix for the glob
Diffstat (limited to 'bash/bashrc.d/pass.bash')
-rw-r--r-- | bash/bashrc.d/pass.bash | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/bash/bashrc.d/pass.bash b/bash/bashrc.d/pass.bash index e8748118..12539a17 100644 --- a/bash/bashrc.d/pass.bash +++ b/bash/bashrc.d/pass.bash @@ -15,7 +15,6 @@ _pass() # doesn't seem to do this properly with a null delimiter) local entry while IFS= read -d '' -r entry ; do - [[ $entry == "${COMP_WORDS[COMP_CWORD]}"* ]] || continue # We have to use printf %q here to quote the entry, as it may include # spaces or newlines, just like any filename @@ -31,7 +30,7 @@ _pass() # Gather the entries and remove their .gpg suffix declare -a entries - entries=(**/*.gpg) + entries=("${COMP_WORDS[COMP_CWORD]}"*/**/*.gpg "${COMP_WORDS[COMP_CWORD]}"*.gpg) entries=("${entries[@]%.gpg}") # Bail if no entries to prevent empty output |