aboutsummaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'main.go')
-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