minor code cleanup
This commit is contained in:
@@ -56,7 +56,7 @@ func formatLine(stats *probing.Statistics) {
|
|||||||
packetColor = "%{F#d60606}"
|
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) {
|
func formatLineWaybar(stats *probing.Statistics) {
|
||||||
@@ -84,12 +84,10 @@ func main() {
|
|||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
for {
|
for {
|
||||||
time.Sleep(time.Duration(*PingInterval) * time.Second)
|
|
||||||
|
|
||||||
pinger, err := probing.NewPinger(*Host)
|
pinger, err := probing.NewPinger(*Host)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
continue
|
goto sleep
|
||||||
}
|
}
|
||||||
pinger.Count = *PingCount
|
pinger.Count = *PingCount
|
||||||
if *Waybar {
|
if *Waybar {
|
||||||
@@ -100,7 +98,9 @@ func main() {
|
|||||||
|
|
||||||
if pinger.Run() != nil {
|
if pinger.Run() != nil {
|
||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
continue
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sleep:
|
||||||
|
time.Sleep(time.Duration(*PingInterval) * time.Second)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user