diff --git a/conf.go b/conf.go index 7b1be58..791e101 100644 --- a/conf.go +++ b/conf.go @@ -133,8 +133,3 @@ func parseConf(filename string) *Conf { return &conf } - -func parseArgs() map[string]string { - var args map[string]string - return args -} diff --git a/main.go b/main.go index 1758f29..7314dd0 100644 --- a/main.go +++ b/main.go @@ -2,8 +2,10 @@ package main import ( "bufio" + "flag" "fmt" "log" + "os" "os/exec" "strings" "time" @@ -89,7 +91,15 @@ func (s *Stream) handle() { } func main() { - conf := parseConf("./reaction.yml") + confFilename := flag.String("c", "", "configuration file. see an example at https://framagit.org/ppom/reaction/-/blob/main/reaction.yml") + flag.Parse() + + if *confFilename == "" { + flag.PrintDefaults() + os.Exit(2) + } + + conf := parseConf(*confFilename) for _, stream := range conf.Streams { go stream.handle()