106 lines
2.2 KiB
Go
106 lines
2.2 KiB
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"time"
|
|
"color"
|
|
"io/ioutil"
|
|
"bufio"
|
|
"os"
|
|
"strings"
|
|
)
|
|
|
|
|
|
func main() {
|
|
p := fmt.Println
|
|
now := time.Now()
|
|
|
|
blue := color.New(color.FgBlue)
|
|
wheBackground := blue.Add(color.BgWhite)
|
|
wheBackground.Println(" TODAY IS: ")
|
|
p(" ",now.Weekday(),"|",now.Day(),now.Month(),now.Year())
|
|
|
|
white := color.New(color.FgWhite)
|
|
MagentaBackground := white.Add(color.BgMagenta)
|
|
MagentaBackground.Println("\nMED 6:00 14:00 22:00")
|
|
if int(now.Weekday()) == int(1) {
|
|
data, err := ioutil.ReadFile("1.txt")
|
|
if err != nil {
|
|
p("Error", err)
|
|
return
|
|
}
|
|
p(string(data))
|
|
} else {
|
|
if int(now.Weekday()) == int(2) {
|
|
data, err := ioutil.ReadFile("2.txt")
|
|
if err != nil {
|
|
p("Error", err)
|
|
return
|
|
}
|
|
p(string(data))
|
|
} else {
|
|
if int(now.Weekday()) == int(3) {
|
|
data, err := ioutil.ReadFile("3.txt")
|
|
if err != nil {
|
|
p("Error", err)
|
|
return
|
|
}
|
|
p(string(data))
|
|
} else {
|
|
if int(now.Weekday()) == int(4) {
|
|
data, err := ioutil.ReadFile("4.txt")
|
|
if err != nil {
|
|
p("Error", err)
|
|
return
|
|
}
|
|
p(string(data))
|
|
} else {
|
|
if int(now.Weekday()) == int(5) {
|
|
|
|
data, err := ioutil.ReadFile("5.txt")
|
|
if err != nil {
|
|
p("Error", err)
|
|
return
|
|
}
|
|
p(string(data))
|
|
} else {
|
|
if int(now.Weekday()) == int(6) {
|
|
data, err := ioutil.ReadFile("6.txt")
|
|
if err != nil {
|
|
p("Error", err)
|
|
return
|
|
}
|
|
p(string(data))
|
|
} else {
|
|
if int(now.Weekday()) == int(0) {
|
|
data, err := ioutil.ReadFile("7.txt")
|
|
if err != nil {
|
|
p("Error", err)
|
|
return
|
|
}
|
|
p(string(data))
|
|
} else {
|
|
p("Error")
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
red := color.New(color.FgRed)
|
|
whiteBackground := red.Add(color.BgWhite)
|
|
whiteBackground.Println("\n NEXT WEEK YOU'LL RUN OUT OF: ")
|
|
|
|
fileHandle, _ := os.Open("meds.txt")
|
|
defer fileHandle.Close()
|
|
fileScanner := bufio.NewScanner(fileHandle)
|
|
|
|
for fileScanner.Scan() {
|
|
if strings.HasSuffix(fileScanner.Text(), ":0") == true {
|
|
p(" ",fileScanner.Text())}
|
|
}
|
|
|
|
}
|