Skip to content

Commit

Permalink
Sort alphabetically the output of the plugin listing commands (#6810)
Browse files Browse the repository at this point in the history
  • Loading branch information
maurorappa authored and danielnelson committed Dec 17, 2019
1 parent cb915a5 commit 2beb799
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion cmd/telegraf/telegraf.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"os"
"os/signal"
"runtime"
"sort"
"strings"
"syscall"
"time"
Expand Down Expand Up @@ -327,14 +328,24 @@ func main() {
// switch for flags which just do something and exit immediately
switch {
case *fOutputList:
fmt.Println("Available Output Plugins:")
fmt.Println("Available Output Plugins: ")
names := make([]string, 0, len(outputs.Outputs))
for k := range outputs.Outputs {
names = append(names, k)
}
sort.Strings(names)
for _, k := range names {
fmt.Printf(" %s\n", k)
}
return
case *fInputList:
fmt.Println("Available Input Plugins:")
names := make([]string, 0, len(inputs.Inputs))
for k := range inputs.Inputs {
names = append(names, k)
}
sort.Strings(names)
for _, k := range names {
fmt.Printf(" %s\n", k)
}
return
Expand Down

0 comments on commit 2beb799

Please sign in to comment.