From 193481a0ce0e6becb7edad8c4c581756d24b3632 Mon Sep 17 00:00:00 2001 From: ppom <> Date: Fri, 24 Mar 2023 17:52:00 +0100 Subject: [PATCH] close #9 --- conf.go | 5 ----- main.go | 12 +++++++++++- 2 files changed, 11 insertions(+), 6 deletions(-) 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()