summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2014-04-18 12:30:50 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2014-04-18 12:30:50 +0200
commit04ff6261ca172aceb09bad926da68c41ba17b78e (patch)
tree16960ef3032838e67ce981cfdd4bc0e50c9ec57a /src
parent84815317659d40319703bac18cd4388990ed4cee (diff)
downloadpass-04ff6261ca172aceb09bad926da68c41ba17b78e.tar.gz
pass-04ff6261ca172aceb09bad926da68c41ba17b78e.tar.bz2
pass-04ff6261ca172aceb09bad926da68c41ba17b78e.zip
bash-completion: filter dot files from results
Diffstat (limited to '')
-rw-r--r--src/completion/pass.bash-completion11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/completion/pass.bash-completion b/src/completion/pass.bash-completion
index d8d65c7..332bf51 100644
--- a/src/completion/pass.bash-completion
+++ b/src/completion/pass.bash-completion
@@ -12,15 +12,20 @@ _pass_complete_entries () {
local IFS=$'\n'
local items=($(compgen -f $prefix$cur))
for item in ${items[@]}; do
- [[ $item == $prefix.* ]] && continue
+ [[ $item =~ /\.[^/]*$ ]] && continue
# if there is a unique match, and it is a directory with one entry
# autocomplete the subentry as well (recursively)
if [[ ${#items[@]} -eq 1 && $autoexpand -eq 1 ]]; then
while [[ -d $item ]]; do
local subitems=($(compgen -f "$item/"))
- if [[ ${#subitems[@]} -eq 1 ]]; then
- item="${subitems[0]}"
+ local filtereditems=( )
+ for item2 in "${subitems[@]}"; do
+ [[ $item2 =~ /\.[^/]*$ ]] && continue
+ filtereditems+=( "$item2" )
+ done
+ if [[ ${#filtereditems[@]} -eq 1 ]]; then
+ item="${filtereditems[0]}"
else
break
fi