gotd/helper.go
june 1ec5072ef4 Tasks should be filtered into their specific areas (#5)
All inbox tasks should remain in the inbox. all tasks with a start/deadline time of today should be in today. Any task that does have a start date should be in scheduled. All tasks that do not have a start date should be in Anytime.

Fixes #1
Co-authored-by: june <juniper@breadone.xyz>
Co-committed-by: june <juniper@breadone.xyz>
2025-03-10 18:42:06 +13:00

34 lines
630 B
Go

package main
import (
"os"
"time"
"os/exec"
"runtime"
)
func filter[T any](ss []T, test func(T) bool) (ret []T) {
for _, s := range ss {
if test(s) {
ret = append(ret, s)
}
}
return
}
func midnightToUnix() int64 {
now := time.Now()
midnight := time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, now.Location())
return midnight.Unix()
}
func clearTerminal() {
var cmd *exec.Cmd
if runtime.GOOS == "windows" {
cmd = exec.Command("cmd", "/c", "cls")
} else {
cmd = exec.Command("clear")
}
cmd.Stdout = os.Stdout
cmd.Run()
}