mirror of
https://github.com/asdf-vm/asdf.git
synced 2024-12-24 20:35:03 -07:00
Merge 64d2bb180e
into c778ea1dec
This commit is contained in:
commit
a7916f3c45
@ -130,7 +130,7 @@ list_all_command() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
latest_command() {
|
latest_command() {
|
||||||
DEFAULT_QUERY="[0-9]"
|
DEFAULT_QUERY="v?[0-9]"
|
||||||
|
|
||||||
local plugin_name=$1
|
local plugin_name=$1
|
||||||
local query=$2
|
local query=$2
|
||||||
@ -155,17 +155,13 @@ latest_command() {
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
# pattern from xxenv-latest (https://github.com/momo-lab/xxenv-latest)
|
version=$(_latest_version_helper "$plugin_name" "$query")
|
||||||
versions=$(list_all_command "$plugin_name" "$query" |
|
if [ -z "${version}" ]; then
|
||||||
grep -ivE "(^Available versions:|-src|-dev|-latest|-stm|[-\\.]rc|-milestone|-alpha|-beta|[-\\.]pre|-next|(a|b|c)[0-9]+|snapshot|master)" |
|
|
||||||
sed 's/^[[:space:]]\+//' |
|
|
||||||
tail -1)
|
|
||||||
if [ -z "${versions}" ]; then
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
printf "%s\n" "$versions"
|
printf "%s\n" "$version"
|
||||||
}
|
}
|
||||||
|
|
||||||
latest_all() {
|
latest_all() {
|
||||||
@ -186,11 +182,7 @@ latest_all() {
|
|||||||
version="unknown"
|
version="unknown"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
# pattern from xxenv-latest (https://github.com/momo-lab/xxenv-latest)
|
version=$(_latest_version_helper "$plugin_name")
|
||||||
version=$(list_all_command "$plugin_name" |
|
|
||||||
grep -ivE "(^Available version:|-src|-dev|-latest|-stm|[-\\.]rc|-alpha|-beta|[-\\.]pre|-next|(a|b|c)[0-9]+|snapshot|master)" |
|
|
||||||
sed 's/^[[:space:]]\+//' |
|
|
||||||
tail -1)
|
|
||||||
if [ -z "${version}" ]; then
|
if [ -z "${version}" ]; then
|
||||||
version="unknown"
|
version="unknown"
|
||||||
fi
|
fi
|
||||||
@ -238,3 +230,11 @@ local_command() {
|
|||||||
version_command local "$@"
|
version_command local "$@"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_latest_version_helper() {
|
||||||
|
# pattern from xxenv-latest (https://github.com/momo-lab/xxenv-latest/blob/fe8fb00d55d2fb8daca834214f7ac614f87c255f/bin/xxenv-latest#L85)
|
||||||
|
list_all_command "$@" |
|
||||||
|
grep -ivE "(^Available versions?:|-src|-dev|-latest|-stm|[-\\.]rc|-alpha|-beta|[-\\.]pre|-next|(a|b|c)[0-9]+$|snapshot|master|-nightly)" |
|
||||||
|
sed 's/^[[:space:]]\+//' |
|
||||||
|
tail -1
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user