aboutsummaryrefslogtreecommitdiff
path: root/bash/bash_completion.d/ud.bash
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2018-10-30 10:31:53 +1300
committerTom Ryder <tom@sanctum.geek.nz>2018-10-30 10:31:53 +1300
commita8c7c927dcf3c020389fd25c3e81e6c072a25dd1 (patch)
treeb2eeffa04f868f4335de1bf4ce238754788d5db2 /bash/bash_completion.d/ud.bash
parentUse case statement for sudo -v switching (diff)
downloaddotfiles-a8c7c927dcf3c020389fd25c3e81e6c072a25dd1.tar.gz
dotfiles-a8c7c927dcf3c020389fd25c3e81e6c072a25dd1.zip
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.
Diffstat (limited to 'bash/bash_completion.d/ud.bash')
-rw-r--r--bash/bash_completion.d/ud.bash14
1 files changed, 14 insertions, 0 deletions
diff --git a/bash/bash_completion.d/ud.bash b/bash/bash_completion.d/ud.bash
index 47171b78..eb038e12 100644
--- a/bash/bash_completion.d/ud.bash
+++ b/bash/bash_completion.d/ud.bash
@@ -13,6 +13,20 @@ _ud() {
# Set options to glob correctly
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)
+
# Collect directory names, strip trailing slashes
local -a dirnames
dirnames=("${COMP_WORDS[COMP_CWORD]}"*/)