provide args for telegraf for consistency with influxd:

- telegraf version
- telegraf config

closes #857
This commit is contained in:
Cameron Sparr 2016-03-16 14:22:01 -06:00
parent f8e9fafda3
commit 822706367b
1 changed files with 14 additions and 1 deletions

View File

@ -96,8 +96,9 @@ func main() {
reload <- false
flag.Usage = func() { usageExit(0) }
flag.Parse()
args := flag.Args()
if flag.NFlag() == 0 {
if flag.NFlag() == 0 && len(args) == 0 {
usageExit(0)
}
@ -121,6 +122,18 @@ func main() {
outputFilters = strings.Split(":"+outputFilter+":", ":")
}
if len(args) > 0 {
switch args[0] {
case "version":
v := fmt.Sprintf("Telegraf - Version %s", Version)
fmt.Println(v)
return
case "config":
config.PrintSampleConfig(inputFilters, outputFilters)
return
}
}
if *fOutputList {
fmt.Println("Available Output Plugins:")
for k, _ := range outputs.Outputs {