1
0
Fork 0
mirror of https://github.com/zplug/zplug synced 2024-05-21 15:06:12 +02:00

Detect binary more flexibly for releases

This commit is contained in:
b4b4r07 2017-12-27 02:26:05 +09:00
parent 8e61577a64
commit 7646b2fbc7

View File

@ -212,12 +212,19 @@ __zplug::utils::releases::index()
esac
# TODO: more strictly
binaries=(**/*(N-*))
binaries=()
binaries+=(**/*$cmd*(N-.)) # contains $cmd name files
binaries+=(**/*(N-*)) # contains executable files
binaries+=( $(file **/*(N-.) | awk -F: '$2 ~ /executable/{print $1}') )
if (( $#binaries == 0 )); then
# Failed to grab binaries from GitHub Releases"
# TODO: logging
return 1
fi
# For debug
if (( $#binaries > 1 )); then
__zplug::io::print::die "$cmd: Found ${(qqqj:,:)binaries[@]} in $repo\n"
fi
mv -f "$binaries[1]" "$cmd"
chmod 755 "$cmd"