Skip to content

Commit 46ed131

Browse files
committed
fix(man,info): fix for failglob
1 parent 07ea44b commit 46ed131

File tree

2 files changed

+11
-15
lines changed

2 files changed

+11
-15
lines changed

completions/info

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -57,16 +57,13 @@ _info()
5757
_comp_unlocal IFS
5858

5959
if ((${#COMPREPLY[@]})); then
60-
# weed out directory path names and paths to info pages
61-
COMPREPLY=(${COMPREPLY[@]##*/?(:)})
62-
# weed out info dir file
63-
for i in ${!COMPREPLY[*]}; do
64-
[[ ${COMPREPLY[i]} == dir ]] && unset -v 'COMPREPLY[i]'
65-
done
60+
# weed out directory path names and paths to info pages (empty
61+
# elements will be removed by the later `compgen -X ''`)
62+
COMPREPLY=("${COMPREPLY[@]##*/?(:)}")
6663
# strip suffix from info pages
67-
COMPREPLY=(${COMPREPLY[@]%.@(gz|bz2|xz|lzma)})
68-
((${#COMPREPLY[@]})) &&
69-
COMPREPLY=($(compgen -W '"${COMPREPLY[@]%.*}"' -- "${cur//\\\\/}"))
64+
COMPREPLY=("${COMPREPLY[@]%.@(gz|bz2|xz|lzma)}")
65+
# weed out info dir file with -X 'dir'
66+
_comp_split -l COMPREPLY "$(compgen -W '"${COMPREPLY[@]%.*}"' -X '@(|dir)' -- "${cur//\\\\/}")"
7067
fi
7168
fi
7269
} &&

completions/man

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,12 @@ _man()
8585
_comp_unlocal IFS
8686

8787
if ((${#COMPREPLY[@]} != 0)); then
88-
# weed out directory path names and paths to man pages
89-
COMPREPLY=(${COMPREPLY[@]##*/?(:)})
88+
# weed out directory path names and paths to man pages (empty
89+
# elements will be removed by the later `compgen -X ''`)
90+
COMPREPLY=("${COMPREPLY[@]##*/?(:)}")
9091
# strip suffix from man pages
91-
((${#COMPREPLY[@]})) &&
92-
COMPREPLY=(${COMPREPLY[@]%$comprsuffix})
93-
((${#COMPREPLY[@]})) &&
94-
COMPREPLY=($(compgen -W '"${COMPREPLY[@]%.*}"' -- "${cur//\\\\/}"))
92+
COMPREPLY=("${COMPREPLY[@]%$comprsuffix}")
93+
_comp_split -l COMPREPLY "$(compgen -W '"${COMPREPLY[@]%.*}"' -X '' -- "${cur//\\\\/}")"
9594
fi
9695
fi
9796

0 commit comments

Comments
 (0)