From a8c7c927dcf3c020389fd25c3e81e6c072a25dd1 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Tue, 30 Oct 2018 10:31:53 +1300 Subject: Respect completion-ignore-case in custom functions This involves a little too much boilerplate for my liking, but it's still an improvement over what I had before. I might find a way to make this into a generic function. --- bash/bash_completion.d/pass.bash | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'bash/bash_completion.d/pass.bash') diff --git a/bash/bash_completion.d/pass.bash b/bash/bash_completion.d/pass.bash index feff78ae..e697f5d1 100644 --- a/bash/bash_completion.d/pass.bash +++ b/bash/bash_completion.d/pass.bash @@ -23,6 +23,20 @@ _pass() shopt -u dotglob shopt -s globstar nullglob + # Make globbing case-insensitive if appropriate; is there a cleaner way + # to find this value? + while read -r _ option value ; do + case $option in + completion-ignore-case) + case $value in + on) + shopt -s nocaseglob + break + ;; + esac + esac + done < <(bind -v) + # Gather the entries and remove their .gpg suffix declare -a entries entries=("$passdir"/"${COMP_WORDS[COMP_CWORD]}"*/**/*.gpg \ -- cgit v1.2.3