From 2b40dd23514838fb3528146431fa7160243c12f6 Mon Sep 17 00:00:00 2001 From: Malcolm Akinje Date: Thu, 25 Oct 2018 10:33:35 -0400 Subject: [PATCH] Added README.md and argument checks for news.go --- .gitignore | 3 +-- README.md | 27 +++++++++++++++++++++++++++ news.go | 7 ++++++- 3 files changed, 34 insertions(+), 3 deletions(-) create mode 100644 README.md diff --git a/.gitignore b/.gitignore index 987ef5e..3b0cb0d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,2 @@ .idea/ -*.exe -assets/ \ No newline at end of file +*.exe \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..5869939 --- /dev/null +++ b/README.md @@ -0,0 +1,27 @@ +# **Overview** +This go service through the use of Twilio and NewsAPI will hit the NewsAPI endpoint for igns headlines and send them to your cellphone number along with a small description of the headline and a link to the article or video. + +# **Setup** +For this program to work you need to export these things in your environment: + +``` +export TWILIO_API_KEY=[api-key] +export TWILIO_SID=[account-sid] +export TWILIO_NUMBER=[your twilio number] +export NEWS_API_KEY=[api-key] +``` + +Both your Twilio API key and account SID can be found on your twilio console + +News API key can be found after signing up with https://newsapi.org/ + +# **Usage** +The contract for this program is as follows: + +``` +./news +``` + +Note: the number needs to have the country Dialing code as well. +So for the United States an example number would be +`+15555555555` \ No newline at end of file diff --git a/news.go b/news.go index 0d523a6..f2c95a9 100644 --- a/news.go +++ b/news.go @@ -31,7 +31,12 @@ type IgnResponse struct { } func main() { - setTimer() + if len(os.Args) == 2 { + setTimer() + } else { + print("Usage:\n") + print(" ./news \n") + } } func setTimer() {