diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2016-09-20 14:48:40 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2016-09-20 14:48:40 +1200 |
commit | 8350e52505b26daecaa22023619c6367bf4b8646 (patch) | |
tree | 5fcc8fcc20acffed9c4f678d1149c5c2521c1cd4 | |
parent | Add mex(1df) (diff) | |
download | dotfiles-8350e52505b26daecaa22023619c6367bf4b8646.tar.gz dotfiles-8350e52505b26daecaa22023619c6367bf4b8646.zip |
Add completion for mex(1df)
-rw-r--r-- | bash/bash_completion.d/mex.bash | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/bash/bash_completion.d/mex.bash b/bash/bash_completion.d/mex.bash new file mode 100644 index 00000000..d25f1824 --- /dev/null +++ b/bash/bash_completion.d/mex.bash @@ -0,0 +1,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 |