Sort alphabetically the output of the plugin listing commands (#6810)

This commit is contained in:
maurorappa 2019-12-17 20:44:17 +00:00 committed by Daniel Nelson
parent cb915a5c5a
commit 2beb79969a
1 changed files with 12 additions and 1 deletions

View File

@ -11,6 +11,7 @@ import (
"os" "os"
"os/signal" "os/signal"
"runtime" "runtime"
"sort"
"strings" "strings"
"syscall" "syscall"
"time" "time"
@ -328,13 +329,23 @@ func main() {
switch { switch {
case *fOutputList: case *fOutputList:
fmt.Println("Available Output Plugins: ") fmt.Println("Available Output Plugins: ")
names := make([]string, 0, len(outputs.Outputs))
for k := range outputs.Outputs { for k := range outputs.Outputs {
names = append(names, k)
}
sort.Strings(names)
for _, k := range names {
fmt.Printf(" %s\n", k) fmt.Printf(" %s\n", k)
} }
return return
case *fInputList: case *fInputList:
fmt.Println("Available Input Plugins:") fmt.Println("Available Input Plugins:")
names := make([]string, 0, len(inputs.Inputs))
for k := range inputs.Inputs { for k := range inputs.Inputs {
names = append(names, k)
}
sort.Strings(names)
for _, k := range names {
fmt.Printf(" %s\n", k) fmt.Printf(" %s\n", k)
} }
return return