Skip to content

Commit

Permalink
Merge pull request #1564 from estroz/chore/sort-cli
Browse files Browse the repository at this point in the history
pkg/cli/init.go: make flag help consistent
  • Loading branch information
k8s-ci-robot committed Jun 18, 2020
2 parents 9aa6ab6 + 2943581 commit 36aa113
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion pkg/cli/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"fmt"
"log"
"os"
"sort"
"strconv"
"strings"

Expand Down Expand Up @@ -100,18 +101,24 @@ func (c cli) getAvailableProjectVersions() (projectVersions []string) {
for version := range versionSet {
projectVersions = append(projectVersions, strconv.Quote(version))
}
sort.Strings(projectVersions)
return projectVersions
}

func (c cli) getAvailablePlugins() (pluginKeys []string) {
keySet := make(map[string]struct{})
for _, versionedPlugins := range c.pluginsFromOptions {
for _, p := range versionedPlugins {
// Only return non-deprecated plugins.
if _, isDeprecated := p.(plugin.Deprecated); !isDeprecated {
pluginKeys = append(pluginKeys, strconv.Quote(plugin.KeyFor(p)))
keySet[plugin.KeyFor(p)] = struct{}{}
}
}
}
for key := range keySet {
pluginKeys = append(pluginKeys, strconv.Quote(key))
}
sort.Strings(pluginKeys)
return pluginKeys
}

Expand Down

0 comments on commit 36aa113

Please sign in to comment.