minor code cleanup
This commit is contained in:
@@ -56,7 +56,7 @@ func formatLine(stats *probing.Statistics) {
|
||||
packetColor = "%{F#d60606}"
|
||||
}
|
||||
|
||||
fmt.Printf("%s%dms %%{F-}| %s%d%%\n", rttColor, stats.AvgRtt.Milliseconds(), packetColor, int(math.Round(stats.PacketLoss)))
|
||||
fmt.Printf("%%{F-}\uE4E2 %s%dms %%{F-}\uF1B2 %s%d%%\n", rttColor, stats.AvgRtt.Milliseconds(), packetColor, int(math.Round(stats.PacketLoss)))
|
||||
}
|
||||
|
||||
func formatLineWaybar(stats *probing.Statistics) {
|
||||
@@ -84,12 +84,10 @@ func main() {
|
||||
flag.Parse()
|
||||
|
||||
for {
|
||||
time.Sleep(time.Duration(*PingInterval) * time.Second)
|
||||
|
||||
pinger, err := probing.NewPinger(*Host)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
continue
|
||||
goto sleep
|
||||
}
|
||||
pinger.Count = *PingCount
|
||||
if *Waybar {
|
||||
@@ -100,7 +98,9 @@ func main() {
|
||||
|
||||
if pinger.Run() != nil {
|
||||
fmt.Println(err)
|
||||
continue
|
||||
}
|
||||
|
||||
sleep:
|
||||
time.Sleep(time.Duration(*PingInterval) * time.Second)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user