Skip to content

Commit

Permalink
done
Browse files Browse the repository at this point in the history
  • Loading branch information
tuvia-akeyless committed Feb 4, 2024
1 parent e24c7df commit 1340ab7
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion command.go
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,8 @@ func (cmd *Command) ChildrenDescriptions(prefix, indent string) string {
}
}
format := fmt.Sprintf("%s%%-%ds%s%%s%%s\n", prefix, length, indent)

var childrenList []string
for _, child := range cmd.children {
if child.Hidden {
continue
Expand All @@ -538,7 +540,15 @@ func (cmd *Command) ChildrenDescriptions(prefix, indent string) string {
aliasesBuff.WriteString(")")
aliases = aliasesBuff.String()
}
fmt.Fprintf(buff, format, child.Name, child.Desc, aliases)

childStr := fmt.Sprintf(format, child.Name, child.Desc, aliases)
childrenList = append(childrenList, childStr)
}

sort.Strings(childrenList)

for _, line := range childrenList {
fmt.Fprint(buff, line)
}
return buff.String()
}
Expand Down

0 comments on commit 1340ab7

Please sign in to comment.