File tree Expand file tree Collapse file tree 1 file changed +7
-8
lines changed
Expand file tree Collapse file tree 1 file changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -38,9 +38,10 @@ _z() {
3838 [ -z " $_Z_OWNER " -a -f " $datafile " -a ! -O " $datafile " ] && return
3939
4040 _z_dirs () {
41+ local line
4142 while read line; do
4243 # only count directories
43- [ -d " ${line%% \| * } " ] && echo $line
44+ [ -d " ${line%% \| * } " ] && echo " $line "
4445 done < " $datafile "
4546 return 0
4647 }
6061
6162 # maintain the data file
6263 local tempfile=" $datafile .$RANDOM "
63- awk < <( _z_dirs 2> /dev/null ) -v path=" $* " -v now=" $( date +%s) " -F" |" '
64+ _z_dirs | awk -v path=" $* " -v now=" $( date +%s) " -F" |" '
6465 BEGIN {
6566 rank[path] = 1
6667 time[path] = now
@@ -93,17 +94,15 @@ _z() {
9394
9495 # tab completion
9596 elif [ " $1 " = " --complete" -a -s " $datafile " ]; then
96- while read line; do
97- [ -d " ${line%% \| * } " ] && echo $line
98- done < " $datafile " | awk -v q=" $2 " -F" |" '
97+ _z_dirs | awk -v q=" $2 " -F" |" '
9998 BEGIN {
100- if( q == tolower(q) ) imatch = 1
10199 q = substr(q, 3)
102- gsub(" ", ".*", q)
100+ if( q == tolower(q) ) imatch = 1
101+ gsub(/ /, ".*", q)
103102 }
104103 {
105104 if( imatch ) {
106- if( tolower($1) ~ tolower(q) ) print $1
105+ if( tolower($1) ~ q ) print $1
107106 } else if( $1 ~ q ) print $1
108107 }
109108 ' 2> /dev/null
You can’t perform that action at this time.
0 commit comments