From 97ba649df2e156bff5c8ca21d7ba811fa0120441 Mon Sep 17 00:00:00 2001 From: Julien Dessaux Date: Tue, 6 Apr 2021 16:04:06 +0200 Subject: Added a flag to specify a configuration file and wrote a proper readme --- cmd/trains-webui/main.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'cmd/trains-webui') diff --git a/cmd/trains-webui/main.go b/cmd/trains-webui/main.go index 76f34ea..0ea3b57 100644 --- a/cmd/trains-webui/main.go +++ b/cmd/trains-webui/main.go @@ -1,14 +1,25 @@ package main import ( + "flag" "log" + "os" "git.adyxax.org/adyxax/trains/internal/webui" "git.adyxax.org/adyxax/trains/pkg/config" ) func main() { - c, err := config.LoadFile("/home/julien/.config/adyxax-trains/config.yaml") + path := flag.String("c", os.Getenv("HOME")+"/.config/trains/config.yaml", "configuration file path") + help := flag.Bool("h", false, "display this help message") + flag.Parse() + + if *help { + flag.Usage() + os.Exit(0) + } + + c, err := config.LoadFile(*path) if err != nil { log.Fatal(err) } -- cgit v1.2.3