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

make fvm segment work with fvm >= 1.0.0; see #842

This commit is contained in:
Roman Perepelitsa 2020-06-25 09:03:59 +02:00
parent 1be10ebcf7
commit 6a1e993a05

View file

@ -1224,14 +1224,32 @@ function _p9k_read_file() {
[[ -n $_p9k__ret ]]
}
prompt_fvm() {
_p9k_upglob fvm && return
local link=$_p9k__parent_dirs[$?]/fvm
if [[ -L $link ]]; then
if [[ ${link:A} == (#b)*/versions/([^/]##)/bin/flutter ]]; then
function _p9k_fvm_old() {
_p9k_upglob fvm && return 1
local fvm=$_p9k__parent_dirs[$?]/fvm
if [[ -L $fvm ]]; then
if [[ ${fvm:A} == (#b)*/versions/([^/]##)/bin/flutter ]]; then
_p9k_prompt_segment $0 blue $_p9k_color1 FLUTTER_ICON 0 '' ${match[1]//\%/%%}
return 0
fi
fi
return 1
}
function _p9k_fvm_new() {
_p9k_upglob .fvm && return 1
local sdk=$_p9k__parent_dirs[$?]/.fvm/flutter_sdk
if [[ -L $sdk ]]; then
if [[ ${sdk:A} == (#b)*/versions/([^/]##) ]]; then
_p9k_prompt_segment $0 blue $_p9k_color1 FLUTTER_ICON 0 '' ${match[1]//\%/%%}
return 0
fi
fi
return 1
}
prompt_fvm() {
_p9k_fvm_new || _p9k_fvm_old
}
_p9k_prompt_fvm_init() {