diff options
-rw-r--r-- | main.go | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -2,6 +2,7 @@ package main import ( "bufio" + "flag" "fmt" "os" @@ -9,9 +10,13 @@ import ( ) func main() { - f, err := os.Open("stasher.cfg") + var configpath *string + configpath = flag.String("c", "stasher.cfg", "Path to config file") + flag.Parse() + + f, err := os.Open(*configpath) if err != nil { - fmt.Fprintf(os.Stderr, "Could not open config file 'stasher.cfg': %q\n", err) + fmt.Fprintf(os.Stderr, "Could not open config file %q: %q\n", *configpath, err) os.Exit(1) } |