aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjoop <Joop Kiefte>2022-04-02 15:14:06 +0100
committerjoop <Joop Kiefte>2022-04-02 15:14:06 +0100
commitade606c58c99c77c0bec5298dca46df70fc18abd (patch)
tree5ebda99a6550e1d98163986f3c2dd7c3710fd4e9
parent7b47ec83925cece4199b6d23c96002c645c55990 (diff)
Add option to just merge
-rw-r--r--main.go16
1 files changed, 14 insertions, 2 deletions
diff --git a/main.go b/main.go
index 458659c..6d0deff 100644
--- a/main.go
+++ b/main.go
@@ -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