diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2015-06-04 01:16:04 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2015-06-04 01:16:04 +1200 |
commit | f89597d110935a35897c76a169c1119f4f849fda (patch) | |
tree | 6fed9aefaa0c706a546b941bd8e63c325500c20e /bash/bashrc.d | |
parent | Add vared function for editing vars (diff) | |
download | dotfiles-f89597d110935a35897c76a169c1119f4f849fda.tar.gz dotfiles-f89597d110935a35897c76a169c1119f4f849fda.zip |
Handle empty pass(1) completes better
Diffstat (limited to 'bash/bashrc.d')
-rw-r--r-- | bash/bashrc.d/pass.bash | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/bash/bashrc.d/pass.bash b/bash/bashrc.d/pass.bash index d60a6022..61550b9e 100644 --- a/bash/bashrc.d/pass.bash +++ b/bash/bashrc.d/pass.bash @@ -19,11 +19,9 @@ _pass() local word=${COMP_WORDS[COMP_CWORD]} local entry while read -d '' -r entry ; do - if [[ $entry && $entry == "$word"* ]] ; then + if [[ $entry == "$word"* ]] ; then COMPREPLY=("${COMPREPLY[@]}" "$entry") fi - - # This part provides the input to the while loop done < <( # Set shell options to expand globs the way we expect @@ -40,7 +38,9 @@ _pass() entries=("${entries[@]%.gpg}") # Print all the entries, null-delimited - printf '%s\0' "${entries[@]}" + if ((${#entries[@]})) ; then + printf '%s\0' "${entries[@]}" + fi ) } complete -F _pass pass |