diff --git a/home/.bash_profile.d/bash_completions.d/make b/home/.bash_profile.d/bash_completions.d/make new file mode 100644 index 0000000..96517c2 --- /dev/null +++ b/home/.bash_profile.d/bash_completions.d/make @@ -0,0 +1,170 @@ +# bash completion for GNU make -*- shell-script -*- + +_make_target_extract_script() +{ + local mode="$1" + shift + + local prefix="$1" + local prefix_pat=$(command sed 's/[][\,.*^$(){}?+|/]/\\&/g' <<<"$prefix") + local basename=${prefix##*/} + local dirname_len=$((${#prefix} - ${#basename})) + + if [[ $mode == -d ]]; then + # display mode, only output current path component to the next slash + local output="\2" + else + # completion mode, output full path to the next slash + local output="\1\2" + fi + + cat <