Skip to content

Commit

Permalink
chore: add comment
Browse files Browse the repository at this point in the history
  • Loading branch information
mrexox committed Oct 7, 2023
1 parent d186de6 commit f00fd40
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion internal/lefthook/run/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -532,9 +532,13 @@ func (r *Runner) logExecute(name string, err error, out io.Reader) {
}
}

// sortAlnum sorts the command names by preceding numbers if they occur.
// If the command names starts with letter the command name will be sorted alphabetically.
//
// []string{"1_command", "10command", "3 command", "command5"} // -> 1_command, 3 command, 10command, command5
func sortAlnum(strs []string) {
sort.SliceStable(strs, func(i, j int) bool {
var numEnds int = -1
numEnds := -1
for idx, ch := range strs[i] {
if unicode.IsDigit(ch) {
numEnds = idx
Expand Down

0 comments on commit f00fd40

Please sign in to comment.