Minor change to forgotten config file exit

This commit is contained in:
Cameron Sparr 2016-02-01 17:44:19 -07:00
parent d266dad1f4
commit a11e07e250
1 changed files with 6 additions and 7 deletions

View File

@ -87,11 +87,11 @@ func main() {
reload <- true reload <- true
for <-reload { for <-reload {
reload <- false reload <- false
flag.Usage = usageExit flag.Usage = func() { usageExit(0) }
flag.Parse() flag.Parse()
if flag.NFlag() == 0 { if flag.NFlag() == 0 {
usageExit() usageExit(0)
} }
var inputFilters []string var inputFilters []string
@ -148,9 +148,8 @@ func main() {
log.Fatal(err) log.Fatal(err)
} }
} else { } else {
fmt.Println("Usage: Telegraf") fmt.Println("You must specify a config file. See telegraf --help")
flag.PrintDefaults() os.Exit(1)
return
} }
if *fConfigDirectoryLegacy != "" { if *fConfigDirectoryLegacy != "" {
@ -235,7 +234,7 @@ func main() {
} }
} }
func usageExit() { func usageExit(rc int) {
fmt.Println(usage) fmt.Println(usage)
os.Exit(0) os.Exit(rc)
} }