mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2024-09-20 05:27:31 -07:00
parent
7e35ff4fbc
commit
b34f8bbbf3
|
@ -9,7 +9,6 @@ import (
|
||||||
"oh-my-posh/properties"
|
"oh-my-posh/properties"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
http2 "net/http"
|
http2 "net/http"
|
||||||
|
@ -147,24 +146,16 @@ func (w *Withings) Template() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *Withings) Enabled() bool {
|
func (w *Withings) Enabled() bool {
|
||||||
wg := sync.WaitGroup{}
|
|
||||||
wg.Add(3)
|
|
||||||
functions := []func() bool{
|
|
||||||
w.getMeasures,
|
|
||||||
w.getActivities,
|
|
||||||
w.getSleep,
|
|
||||||
}
|
|
||||||
var enabled bool
|
var enabled bool
|
||||||
for _, function := range functions {
|
if w.getActivities() {
|
||||||
go func(f func() bool) {
|
enabled = true
|
||||||
defer wg.Done()
|
}
|
||||||
success := f()
|
if w.getMeasures() {
|
||||||
if success {
|
enabled = true
|
||||||
enabled = true
|
}
|
||||||
}
|
if w.getSleep() {
|
||||||
}(function)
|
enabled = true
|
||||||
}
|
}
|
||||||
wg.Wait()
|
|
||||||
return enabled
|
return enabled
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue