mirror of
https://github.com/taigrr/wtf
synced 2026-03-21 14:12:17 -07:00
Add 'withDate' option to digitalclock module (#797)
When `withDate` is `true`, it displays date information below the clock. When `withDate` is `false`, it does not display date information. Defaults to `true`. Signed-off-by: Chris Cummer <chriscummer@me.com>
This commit is contained in:
@@ -8,15 +8,20 @@ func mergeLines(outString []string) string {
|
||||
|
||||
func renderWidget(widgetSettings Settings) string {
|
||||
outputStrings := []string{}
|
||||
|
||||
clockString, needBorder := renderClock(widgetSettings)
|
||||
if needBorder {
|
||||
outputStrings = append(outputStrings, mergeLines([]string{"", clockString, ""}))
|
||||
} else {
|
||||
outputStrings = append(outputStrings, clockString)
|
||||
}
|
||||
outputStrings = append(outputStrings, getDate())
|
||||
outputStrings = append(outputStrings, getUTC())
|
||||
outputStrings = append(outputStrings, getEpoch())
|
||||
|
||||
if widgetSettings.withDate {
|
||||
outputStrings = append(outputStrings, getDate())
|
||||
outputStrings = append(outputStrings, getUTC())
|
||||
outputStrings = append(outputStrings, getEpoch())
|
||||
}
|
||||
|
||||
return mergeLines(outputStrings)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user