From 203575b1f97501fd190bea67c11552f0635faa8d Mon Sep 17 00:00:00 2001 From: Jackson Taylor Date: Wed, 8 Apr 2020 17:47:08 -0400 Subject: Make Bar its own file Add bar.go Add refresh rate to bar struct --- bar.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 bar.go (limited to 'bar.go') diff --git a/bar.go b/bar.go new file mode 100644 index 0000000..5974ff4 --- /dev/null +++ b/bar.go @@ -0,0 +1,21 @@ +package main + +import "time" + +// Bar is the struct that holds each of the modules and displays the data from them +type Bar struct { + Modules []Module + RefreshRate time.Duration +} + +func (b Bar) Display() string { + var val string + + for _, mod := range b.Modules { + s, _ := mod.GetInfo() + val += s + time.Sleep(b.RefreshRate) + } + + return val +} -- cgit v1.2.3