123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- package doc
- import (
- "strings"
- "github.com/spf13/cobra"
- )
- func hasSeeAlso(cmd *cobra.Command) bool {
- if cmd.HasParent() {
- return true
- }
- for _, c := range cmd.Commands() {
- if !c.IsAvailableCommand() || c.IsAdditionalHelpTopicCommand() {
- continue
- }
- return true
- }
- return false
- }
- func forceMultiLine(s string) string {
- if len(s) > 60 && !strings.Contains(s, "\n") {
- s = s + "\n"
- }
- 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() }
|