diff options
author | joop <Joop Kiefte> | 2022-04-02 15:14:06 +0100 |
---|---|---|
committer | joop <Joop Kiefte> | 2022-04-02 15:14:06 +0100 |
commit | ade606c58c99c77c0bec5298dca46df70fc18abd (patch) | |
tree | 5ebda99a6550e1d98163986f3c2dd7c3710fd4e9 | |
parent | 7b47ec83925cece4199b6d23c96002c645c55990 (diff) |
Add option to just merge
-rw-r--r-- | main.go | 16 |
1 files changed, 14 insertions, 2 deletions
@@ -361,7 +361,7 @@ func main() { 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: ") + fmt.Print("Input a keyword for this prayer, skip to pick another one or code to enter the code manually, or quit to just save and quit: ") keyword := prompt.MustRead[string]() if keyword == "skip" { break @@ -371,6 +371,15 @@ func main() { code = prompt.MustRead[string]() break } + if keyword == "quit" { + fmt.Println("Saving and quitting") + err := WriteCodeList(CodeList) + if err != nil { + fmt.Println("Could not write code list: " + err.Error()) + continue + } + return + } var Matches []Prayer // Check for the prayer text of each prayer in // PrayersWithCode if there is a match with the keyword @@ -414,7 +423,10 @@ func main() { // If the code is not empty, add it to the code list // and write the code list to CodeList.csv CodeList[prayer.Id] = code - WriteCodeList(CodeList) + err = WriteCodeList(CodeList) + if err != nil { + fmt.Println("Could not write code list: " + err.Error()) + } } // Ask if the user wants to identify another prayer // or if they want to quit |