summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrsiddharth <s@ricketyspace.net>2020-09-19 12:51:01 -0400
committerrsiddharth <s@ricketyspace.net>2020-09-19 12:51:01 -0400
commit7929e121961b3c14522aad58a60f0e6880267737 (patch)
treebba3deeeef41c5f0aa03f0cb65f7a91e34bfce30
parent0f1fc8190fd45ae3a0bb58079fd640b5ac087098 (diff)
cedar.go: add emailTo
Read "To" address from commandline and set it in `emailTo`.
-rw-r--r--cedar.go16
1 files changed, 15 insertions, 1 deletions
diff --git a/cedar.go b/cedar.go
index 51159d1..8187373 100644
--- a/cedar.go
+++ b/cedar.go
@@ -3,6 +3,7 @@ package main
import (
"encoding/json"
"encoding/xml"
+ "flag"
"io"
"net/http"
"os"
@@ -28,6 +29,11 @@ type Feed struct {
type Ids []string
+func init() {
+ var emailTo string
+ flag.StringVar(&emailTo, "t", "", "Email address for sending emails to")
+}
+
func newsFeed() ([]byte, error) {
// Init feed.
feed := make([]byte, 0)
@@ -201,4 +207,12 @@ func processNews() error {
return nil
}
-func main() {}
+func main() {
+ flag.Parse()
+
+ // Quit if emailTo is not set.
+ if flag.NFlag() != 1 {
+ flag.PrintDefaults()
+ return
+ }
+}