1
0
Fork 0
mirror of https://github.com/romkatv/powerlevel10k.git synced 2024-11-14 09:00:07 +00:00

bug fix: handle empty versions in legacy asdf files correctly

This commit is contained in:
romkatv 2020-02-08 17:00:31 +01:00
parent 160fb52f47
commit 540f895669

View file

@ -4614,19 +4614,18 @@ function _p9k_asdf_parse_version_file() {
if (( is_legacy )); then if (( is_legacy )); then
local plugin has_parse local plugin has_parse
for plugin has_parse in $=_p9k_asdf_file_info[$file:t]; do for plugin has_parse in $=_p9k_asdf_file_info[$file:t]; do
(( $+versions[$plugin] )) && continue
local cached=$_p9k_asdf_file2versions[$plugin:$file] local cached=$_p9k_asdf_file2versions[$plugin:$file]
if [[ $cached == $stat[1]:* ]]; then if [[ $cached == $stat[1]:* ]]; then
versions[$plugin]=${cached#*:} local v=${cached#*:}
else else
if (( has_parse )); then if (( has_parse )); then
local v=($(${ASDF_DATA_DIR:-~/.asdf}/plugins/$plugin/bin/parse-legacy-file $file 2>/dev/null)) local v=($(${ASDF_DATA_DIR:-~/.asdf}/plugins/$plugin/bin/parse-legacy-file $file 2>/dev/null))
else else
{ local v=($(<$file)) } 2>/dev/null { local v=($(<$file)) } 2>/dev/null
fi fi
(( $#v )) && versions[$plugin]="$v"
_p9k_asdf_file2versions[$plugin:$file]=$stat[1]:"$v" _p9k_asdf_file2versions[$plugin:$file]=$stat[1]:"$v"
fi fi
(( $#v )) && : ${versions[$plugin]="$v"}
done done
else else
local cached=$_p9k_asdf_file2versions[:$file] local cached=$_p9k_asdf_file2versions[:$file]
@ -4645,7 +4644,7 @@ function _p9k_asdf_parse_version_file() {
fi fi
local plugin version local plugin version
for plugin version in $file_versions; do for plugin version in $file_versions; do
(( $+versions[$plugin] )) || versions[$plugin]=$version : ${versions[$plugin]=$version}
done done
fi fi
return 0 return 0