2019-11-27 01:24:29 -07:00
|
|
|
# -*- sh -*-
|
|
|
|
|
2019-11-22 11:37:52 -07:00
|
|
|
latest_command() {
|
|
|
|
DEFAULT_QUERY="[0-9]"
|
|
|
|
|
|
|
|
local plugin_name=$1
|
|
|
|
local query=$2
|
|
|
|
|
|
|
|
[[ -z $query ]] && query="$DEFAULT_QUERY"
|
|
|
|
|
2019-11-22 11:37:53 -07:00
|
|
|
# pattern from xxenv-latest (https://github.com/momo-lab/xxenv-latest)
|
2019-11-29 09:15:38 -07:00
|
|
|
asdf list-all "$plugin_name" "$query" |
|
2020-01-29 06:04:39 -07:00
|
|
|
grep -vE "(^Available versions:|-src|-dev|-latest|-stm|[-\\.]rc|-alpha|-beta|[-\\.]pre|-next|(a|b|c)[0-9]+|snapshot|master)" |
|
2019-11-29 09:15:38 -07:00
|
|
|
sed 's/^\s\+//' |
|
|
|
|
sort --version-sort |
|
|
|
|
tail -1
|
2019-11-22 11:37:52 -07:00
|
|
|
}
|
2019-11-27 01:24:29 -07:00
|
|
|
|
|
|
|
latest_command "$@"
|