File tree Expand file tree Collapse file tree 2 files changed +11
-15
lines changed Expand file tree Collapse file tree 2 files changed +11
-15
lines changed Original file line number Diff line number Diff line change @@ -57,16 +57,13 @@ _info()
57
57
_comp_unlocal IFS
58
58
59
59
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[@]##*/ ?(: )} " )
66
63
# 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// \\\\ / } " ) "
70
67
fi
71
68
fi
72
69
} &&
Original file line number Diff line number Diff line change @@ -85,13 +85,12 @@ _man()
85
85
_comp_unlocal IFS
86
86
87
87
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[@]##*/ ?(: )} " )
90
91
# 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// \\\\ / } " ) "
95
94
fi
96
95
fi
97
96
You can’t perform that action at this time.
0 commit comments