Skip to content

Commit

Permalink
feat(install): Only show binary installable versions with `--list --n…
Browse files Browse the repository at this point in the history
…o-build`
  • Loading branch information
kylef committed Jul 18, 2018
1 parent 2fbd10c commit 031a9ab
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion libexec/swiftenv-install
Original file line number Diff line number Diff line change
Expand Up @@ -204,13 +204,33 @@ find_binary_url_from_api() {
fi
}

sort_versions() {
sed 'h; s/[+-]/./g; s/.p\([[:digit:]]\)/.z\1/; s/$/.z/; G; s/\n/ /' | \
LC_ALL=C sort -t. -k 1,1 -k 2,2n -k 3,3n -k 4,4n -k 5,5n | awk '{print $2}'
}

get_version_list() {
if $snapshots; then
curl -H 'Accept: text/plain' "https://swiftenv-api.fuller.li/versions?snapshot=true&platform=$(get_platform)"
exit
fi

swiftenv-build --definitions
if ([ "$build" == "false" ]); then
VERSIONS="$(ls "$SWIFTENV_SOURCE_PATH/share/swiftenv-install" | grep -v json | sort_versions | uniq)"
PLATFORM="$(get_platform)"

for version in $VERSIONS; do
URL=""
source "$SWIFTENV_SOURCE_PATH/share/swiftenv-install/$version"

if [ -n "$URL" ]; then
echo $version
fi
done
else
swiftenv-build --definitions
fi

exit
}

Expand Down

0 comments on commit 031a9ab

Please sign in to comment.