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/eds.bash | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'bash/bash_completion.d/eds.bash') diff --git a/bash/bash_completion.d/eds.bash b/bash/bash_completion.d/eds.bash index 58ecf402..c4a9b9a9 100644 --- a/bash/bash_completion.d/eds.bash +++ b/bash/bash_completion.d/eds.bash @@ -10,6 +10,21 @@ _eds() { COMPREPLY[${#COMPREPLY[@]}]=$executable done < <( shopt -s dotglob 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) + declare -a files files=("${EDSPATH:-"$HOME"/.local/bin}"/"${COMP_WORDS[COMP_CWORD]}"*) declare -a executables -- cgit v1.2.3