aboutsummaryrefslogtreecommitdiff
path: root/bash/bashrc.d/mysql.bash
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2015-10-21 13:55:39 +1300
committerTom Ryder <tom@sanctum.geek.nz>2015-10-21 13:55:39 +1300
commite8931dff60564306a5a6370f97d7c543e5663f1e (patch)
treee798e3c1085e4e788df2d8119141f407a7feaf24 /bash/bashrc.d/mysql.bash
parentSwitch compopt back out (diff)
downloaddotfiles-e8931dff60564306a5a6370f97d7c543e5663f1e.tar.gz
dotfiles-e8931dff60564306a5a6370f97d7c543e5663f1e.zip
When expanding with globbing, use prefix
Rather than generating all possible completions and then filtering them down, use the completing word as a prefix for the glob
Diffstat (limited to 'bash/bashrc.d/mysql.bash')
-rw-r--r--bash/bashrc.d/mysql.bash3
1 files changed, 1 insertions, 2 deletions
diff --git a/bash/bashrc.d/mysql.bash b/bash/bashrc.d/mysql.bash
index 67feca3c..2faa4e81 100644
--- a/bash/bashrc.d/mysql.bash
+++ b/bash/bashrc.d/mysql.bash
@@ -35,7 +35,6 @@ _mysql() {
# Return the names of the .cnf files sans prefix as completions
local db
while IFS= read -d '' -r db ; do
- [[ $db == "${COMP_WORDS[COMP_CWORD]}"* ]] || continue
COMPREPLY=("${COMPREPLY[@]}" "$db")
done < <(
@@ -44,7 +43,7 @@ _mysql() {
# Collect all the config file names, strip off leading path and .cnf
local -a cnfs
- cnfs=("$dirname"/*.cnf)
+ cnfs=("$dirname"/"${COMP_WORDS[COMP_CWORD]}"*.cnf)
cnfs=("${cnfs[@]#$dirname/}")
cnfs=("${cnfs[@]%.cnf}")