diff options
author | r <r@freesoftwareextremist.com> | 2022-01-27 12:05:15 +0000 |
---|---|---|
committer | r <r@freesoftwareextremist.com> | 2022-01-27 12:05:15 +0000 |
commit | b8c0133bcd5e7f1d4063ad992949cc19d18e7aad (patch) | |
tree | 5322b83d194c9ffcb498627bdd16175f9508d87d /main.go | |
parent | 54c42455f393c5ae8ebdb19884d40ebd9a18f755 (diff) | |
parent | 4ef5e0daf285f41850c9ac53b0322d85fbf5eaec (diff) | |
download | bloat-b8c0133bcd5e7f1d4063ad992949cc19d18e7aad.tar.gz bloat-b8c0133bcd5e7f1d4063ad992949cc19d18e7aad.zip |
Merge branch 'master' into absolute_fluoride
Diffstat (limited to 'main.go')
-rw-r--r-- | main.go | 19 |
1 files changed, 7 insertions, 12 deletions
@@ -2,6 +2,7 @@ package main import ( "errors" + "flag" "fmt" "log" "net/http" @@ -17,7 +18,7 @@ import ( ) var ( - configFile = "/etc/bloat.conf" + configFiles = []string{"bloat.conf", "/etc/bloat.conf"} ) func errExit(err error) { @@ -26,19 +27,13 @@ func errExit(err error) { } func main() { - opts, _, err := util.Getopts(os.Args, "f:") - if err != nil { - errExit(err) - } + configFile := flag.String("f", "", "config file") + flag.Parse() - for _, opt := range opts { - switch opt.Option { - case 'f': - configFile = opt.Value - } + if len(*configFile) > 0 { + configFiles = []string{*configFile} } - - config, err := config.ParseFile(configFile) + config, err := config.ParseFiles(configFiles) if err != nil { errExit(err) } |