From a6e0debe9ad64c42a8746a18012282fcb1cf56d3 Mon Sep 17 00:00:00 2001
From: Tony Blyler <tony@blyler.cc>
Date: Tue, 23 Dec 2014 17:59:25 -0500
Subject: [PATCH] Added CLI arguments and updated the README

---
 README.md  | 11 +++++++++++
 hoarder.go | 13 ++++++++++++-
 2 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/README.md b/README.md
index d255878..c6ba610 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,6 @@
 Hoarder
 ========
+Uploads .torrent files from a local "blackhole" to a remote (SSH) rtorrent watch folder. From there, rtorrent is polled over XMLRPC as to whether the torrent is completed. Finally, the files are downloaded over a multithreaded SSH connection and saved to the local machine. The blackhole is used as a queue and will have its .torrent files deleted.
 
 Requirements
 ------------
@@ -7,3 +8,13 @@ Go
 
 Install
 -------
+1. `go get github.com/tblyler/hoarder`
+2. `go install github.com/tblyler/hoarder`
+
+Configuration
+-------------
+Make sure you make a copy of the conf file in the repo to suit your needs.
+
+Running
+-------
+After installation, just run the hoarder executable with the --config flag to specify where the config file is.
diff --git a/hoarder.go b/hoarder.go
index cd003f8..80e35a1 100644
--- a/hoarder.go
+++ b/hoarder.go
@@ -3,6 +3,7 @@ package main
 
 import (
 	"errors"
+	"flag"
 	"github.com/adampresley/sigint"
 	"io/ioutil"
 	"log"
@@ -214,8 +215,18 @@ func main() {
 		os.Exit(1)
 	})
 
+	var config_path string
+	flag.StringVar(&config_path, "config", "", "Location of the config file")
+	flag.Parse()
+
+	if config_path == "" {
+		log.Println("Missing argument for configuration file path")
+		flag.PrintDefaults()
+		os.Exit(1)
+	}
+
 	log.Println("Reading configuration file")
-	config, err := loadConfig("hoarder.conf")
+	config, err := loadConfig(config_path)
 	if err != nil {
 		log.Println(err)
 		os.Exit(1)