diff options
author | joop <Joop Kiefte> | 2022-04-02 06:02:33 +0100 |
---|---|---|
committer | joop <Joop Kiefte> | 2022-04-02 06:02:33 +0100 |
commit | 8b0e3e29e6af32b8bd1be7f3f34c92e66d9d0e82 (patch) | |
tree | 0ab9cfd1e2ac414fc8a8cf2a99a10522191e1c4f | |
parent | a92cdf9c89a0530f72d1744e132dfdc542fe4b46 (diff) |
Add clear screen and repetition of the prayer for better UX
-rw-r--r-- | main.go | 16 |
1 files changed, 12 insertions, 4 deletions
@@ -329,11 +329,13 @@ func main() { break } } - // Present the text, id and author of the prayer - fmt.Println(prayer.Text) - fmt.Println("ID:", prayer.Id) - fmt.Println("Author:", prayer.Author()) for code == "" { + // Clear the screen + fmt.Print("\033[H\033[2J") + // Present the text, id and author of the prayer + fmt.Println(prayer.Text) + fmt.Println("ID:", prayer.Id) + fmt.Println("Author:", prayer.Author()) // Ask for a keyword fmt.Print("Input a keyword for this prayer, skip to pick another one or code to enter the code manually: ") keyword := prompt.MustRead[string]() @@ -376,6 +378,12 @@ func main() { if answer == "skip" { break } + // If the answer is not y or skip, clear the screen + fmt.Print("\033[H\033[2J") + // Present the text, id and author of the prayer again + fmt.Println(prayer.Text) + fmt.Println("ID:", prayer.Id) + fmt.Println("Author:", prayer.Author()) } } if code != "" { |