From 8350e52505b26daecaa22023619c6367bf4b8646 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Tue, 20 Sep 2016 14:48:40 +1200 Subject: Add completion for mex(1df) --- bash/bash_completion.d/mex.bash | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 bash/bash_completion.d/mex.bash (limited to 'bash') 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 -- cgit v1.2.3