aboutsummaryrefslogtreecommitdiff
path: root/cmd/trains-webui
diff options
context:
space:
mode:
authorJulien Dessaux2021-04-06 16:04:06 +0200
committerJulien Dessaux2021-04-06 16:04:06 +0200
commit97ba649df2e156bff5c8ca21d7ba811fa0120441 (patch)
treedcc3b26147115c6603b7668362e2f08b86767736 /cmd/trains-webui
parentFixed incomplete test case (diff)
downloadtrains-97ba649df2e156bff5c8ca21d7ba811fa0120441.tar.gz
trains-97ba649df2e156bff5c8ca21d7ba811fa0120441.tar.bz2
trains-97ba649df2e156bff5c8ca21d7ba811fa0120441.zip
Added a flag to specify a configuration file and wrote a proper readme
Diffstat (limited to 'cmd/trains-webui')
-rw-r--r--cmd/trains-webui/main.go13
1 files changed, 12 insertions, 1 deletions
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)
}