aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoman Perepelitsa <roman.perepelitsa@gmail.com>2020-06-25 10:03:59 +0300
committerRoman Perepelitsa <roman.perepelitsa@gmail.com>2020-06-25 10:03:59 +0300
commit6a1e993a05439e7829ad91c1699f84c46c82a862 (patch)
treee3802a46596ad4b7c5fed7eeb337560236695717
parent1be10ebcf7dcf5723a3717045fcde3f8ccb91e1a (diff)
make `fvm` segment work with fvm >= 1.0.0; see #842
-rw-r--r--internal/p10k.zsh28
1 files changed, 23 insertions, 5 deletions
diff --git a/internal/p10k.zsh b/internal/p10k.zsh
index 4d09e801..38fbd9ae 100644
--- a/internal/p10k.zsh
+++ b/internal/p10k.zsh
@@ -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() {