aboutsummaryrefslogtreecommitdiff
path: root/bash
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2016-09-20 14:48:40 +1200
committerTom Ryder <tom@sanctum.geek.nz>2016-09-20 14:48:40 +1200
commit8350e52505b26daecaa22023619c6367bf4b8646 (patch)
tree5fcc8fcc20acffed9c4f678d1149c5c2521c1cd4 /bash
parentAdd mex(1df) (diff)
downloaddotfiles-8350e52505b26daecaa22023619c6367bf4b8646.tar.gz
dotfiles-8350e52505b26daecaa22023619c6367bf4b8646.zip
Add completion for mex(1df)
Diffstat (limited to 'bash')
-rw-r--r--bash/bash_completion.d/mex.bash15
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