Skip to content

Commit

Permalink
Merge pull request #1872 from rsteube/conditions-sort
Browse files Browse the repository at this point in the history
doc: sort conditions
  • Loading branch information
rsteube authored Sep 25, 2023
2 parents 6e0d2db + a98f1fe commit d8fd314
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions cmd/carapace/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -322,9 +322,15 @@ func printConditions(format string) string {
}

case "markdown":
sortedNames := make([]string, 0)
for name := range conditions.MacroMap {
sortedNames = append(sortedNames, name)
}
sort.Strings(sortedNames)

s = append(s, "# Conditions", "")
for name, macro := range conditions.MacroMap {
s = append(s, fmt.Sprintf("- [%v](https://pkg.go.dev/github.com/rsteube/carapace-bin/pkg/conditions#Condition%v) %v", name, name, macro.Description))
for _, name := range sortedNames {
s = append(s, fmt.Sprintf("- [%v](https://pkg.go.dev/github.com/rsteube/carapace-bin/pkg/conditions#Condition%v) %v", name, name, conditions.MacroMap[name].Description))
}
}
return strings.Join(s, "\n")
Expand Down

0 comments on commit d8fd314

Please sign in to comment.