Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions doc/man_docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (
"io"
"os"
"path/filepath"
"sort"
"strconv"
"strings"
"time"
Expand Down Expand Up @@ -228,9 +227,7 @@ func genMan(cmd *cobra.Command, header *GenManHeader) []byte {
}
})
}
children := cmd.Commands()
sort.Sort(byName(children))
for _, c := range children {
for _, c := range cmd.Commands() {
if !c.IsAvailableCommand() || c.IsAdditionalHelpTopicCommand() {
continue
}
Expand Down
6 changes: 1 addition & 5 deletions doc/md_docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (
"io"
"os"
"path/filepath"
"sort"
"strings"
"time"

Expand Down Expand Up @@ -95,10 +94,7 @@ func GenMarkdownCustom(cmd *cobra.Command, w io.Writer, linkHandler func(string)
})
}

children := cmd.Commands()
sort.Sort(byName(children))

for _, child := range children {
for _, child := range cmd.Commands() {
if !child.IsAvailableCommand() || child.IsAdditionalHelpTopicCommand() {
continue
}
Expand Down
6 changes: 1 addition & 5 deletions doc/rest_docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (
"io"
"os"
"path/filepath"
"sort"
"strings"
"time"

Expand Down Expand Up @@ -109,10 +108,7 @@ func GenReSTCustom(cmd *cobra.Command, w io.Writer, linkHandler func(string, str
})
}

children := cmd.Commands()
sort.Sort(byName(children))

for _, child := range children {
for _, child := range cmd.Commands() {
if !child.IsAvailableCommand() || child.IsAdditionalHelpTopicCommand() {
continue
}
Expand Down
6 changes: 0 additions & 6 deletions doc/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,3 @@ func forceMultiLine(s string) string {
}
return s
}

type byName []*cobra.Command

func (s byName) Len() int { return len(s) }
func (s byName) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
func (s byName) Less(i, j int) bool { return s[i].Name() < s[j].Name() }
5 changes: 1 addition & 4 deletions doc/yaml_docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import (
"io"
"os"
"path/filepath"
"sort"
"strings"

"github.com/spf13/cobra"
Expand Down Expand Up @@ -123,9 +122,7 @@ func GenYamlCustom(cmd *cobra.Command, w io.Writer, linkHandler func(string) str
parent := cmd.Parent()
result = append(result, parent.CommandPath()+" - "+parent.Short)
}
children := cmd.Commands()
sort.Sort(byName(children))
for _, child := range children {
for _, child := range cmd.Commands() {
if !child.IsAvailableCommand() || child.IsAdditionalHelpTopicCommand() {
continue
}
Expand Down