aboutsummaryrefslogblamecommitdiff
path: root/bash/bash_completion.d/mex.bash
blob: d25f1824d45dfd8944a8f267716e4a753f0e5437 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15














                                                                         
# Completion setup for mex(1df), completing non-executable files in $PATH
_mex() {
    local -a path
    IFS=: read -ra path < <(printf '%s\n' "$PATH")
    local dir name
    for dir in "${path[@]}" ; do
        [[ -d $dir ]] || continue
        for name in "$dir"/* ; do
            [[ -f $name ]] || continue
            ! [[ -x $name ]] || continue
            COMPREPLY[${#COMPREPLY[@]}]=${name##*/}
        done
    done
}
complete -F _mex mex