Write subscriptions

This commit is contained in:
nytpu
2021-03-18 16:28:02 -06:00
parent c3f5f7c682
commit b4d303e24e
2 changed files with 120 additions and 1 deletions
+11 -1
View File
@@ -57,6 +57,11 @@ func main() {
case "refresh":
argCheck(c.Args(), 0, false, "'refresh' doesn't take an argument!")
fetch.RefreshAll(&core.Data, *refreshWorkersFlag)
err = core.Data.WriteSubs(dataPath)
if err != nil {
fmt.Fprintf(os.Stderr, "Error saving subscriptions: %v\n", err)
os.Exit(1)
}
case "list":
argCheck(c.Args(), 0, false, "'list' doesn't take an argument!")
core.Data.Export(os.Stdout)
@@ -78,6 +83,11 @@ func main() {
fmt.Fprintf(os.Stderr, "Error adding URL: %v\n", err)
os.Exit(1)
}
err = core.Data.WriteSubs(dataPath)
if err != nil {
fmt.Fprintf(os.Stderr, "Error saving subscriptions: %v\n", err)
os.Exit(1)
}
case "remove":
argCheck(c.Args(), 1, true, "Please provide a URL to remove.")
delete(core.Data.Feeds, c.Arg(0))
@@ -86,7 +96,7 @@ func main() {
err = core.Data.WriteJSON(dataPath)
if err != nil {
fmt.Fprintf(os.Stderr, "Error saving subscriptions: %v\n", err)
fmt.Fprintf(os.Stderr, "Error saving subscriptions json: %v\n", err)
os.Exit(1)
}
}