Added CLI arguments and updated the README
This commit is contained in:
parent
a32e222ce6
commit
a6e0debe9a
2 changed files with 23 additions and 1 deletions
11
README.md
11
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.
|
||||
|
|
13
hoarder.go
13
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)
|
||||
|
|
Loading…
Reference in a new issue