feat(commands): sort /help output alphabetically
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
ed1d5ec4ea
commit
a2bb4c7704
1 changed files with 7 additions and 2 deletions
|
|
@ -3,6 +3,7 @@ package commands
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -28,8 +29,12 @@ func formatHelpMessage(defs []Definition) string {
|
||||||
return "No commands available."
|
return "No commands available."
|
||||||
}
|
}
|
||||||
|
|
||||||
lines := make([]string, 0, len(defs))
|
sorted := make([]Definition, len(defs))
|
||||||
for _, def := range defs {
|
copy(sorted, defs)
|
||||||
|
sort.Slice(sorted, func(i, j int) bool { return sorted[i].Name < sorted[j].Name })
|
||||||
|
|
||||||
|
lines := make([]string, 0, len(sorted))
|
||||||
|
for _, def := range sorted {
|
||||||
usage := def.EffectiveUsage()
|
usage := def.EffectiveUsage()
|
||||||
if usage == "" {
|
if usage == "" {
|
||||||
usage = "/" + def.Name
|
usage = "/" + def.Name
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue