diff options
Diffstat (limited to 'Completion/User/_make')
-rw-r--r-- | Completion/User/_make | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/Completion/User/_make b/Completion/User/_make index aaae444a8..dc08d4e26 100644 --- a/Completion/User/_make +++ b/Completion/User/_make @@ -1,6 +1,6 @@ #compdef make gmake pmake -local prev="$words[CURRENT-1]" file ret=1 expl +local prev="$words[CURRENT-1]" file expl tmp if [[ "$prev" = -[CI] ]]; then _files -/ @@ -18,11 +18,15 @@ else file='' fi - [[ -n "$file" ]] && _wanted targets expl 'make target' && - compadd "$expl[@]" - \ + if [[ -n "$file" ]] && _wanted targets; then + tmp=( $(awk '/^[a-zA-Z0-9][^\/ \t]+:/ {print $1} /^\.include *<bsd\.port\.(subdir\.|pre\.)?mk>/ || /^\.include *".*mk\/bsd\.pkg\.(subdir\.)?mk"/ { print "fetch fetch-list extract patch configure build install reinstall deinstall package describe checkpatch checksum makesum" }' \ - FS=: $file) && ret=0 - (( ret )) && { compset -P 1 '*='; _files } + FS=: $file) + ) + _loop targets expl 'make target' compadd "$tmp[@]" && return 0 + fi + compset -P 1 '*=' + _files fi |