aboutsummaryrefslogtreecommitdiff
path: root/cmd
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
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')
-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)
}