Skip to content

Commit

Permalink
Merge pull request #12 from thiagokokada/improve-hyprctl
Browse files Browse the repository at this point in the history
examples/hyprctl: avoid unnecessary append in usage
  • Loading branch information
thiagokokada authored Aug 17, 2024
2 parents 13a7d68 + e4de0b9 commit b8b476d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions examples/hyprctl/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,11 @@ func usage(m map[string]func(args []string)) {
fmt.Fprintf(out, "Available subcommands:\n")

// Sort keys before printing, since Go randomises order
subcommands := make([]string, 0, len(m))
subcommands := make([]string, len(m))
i := 0
for s := range m {
subcommands = append(subcommands, s)
subcommands[i] = s
i++
}
sort.Strings(subcommands)
for _, s := range subcommands {
Expand Down

0 comments on commit b8b476d

Please sign in to comment.