Skip to content

Commit 0c5812a

Browse files
committed
Avoid deprecated strings.Title in humanized fields
1 parent 0a58eab commit 0c5812a

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

internal/commands/root.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -897,11 +897,20 @@ func humanizeFieldName(name string) string {
897897
parts[i] = "ID"
898898
continue
899899
}
900-
parts[i] = strings.Title(part)
900+
parts[i] = titleWord(part)
901901
}
902902
return strings.Join(parts, " ")
903903
}
904904

905+
func titleWord(s string) string {
906+
if s == "" {
907+
return s
908+
}
909+
runes := []rune(strings.ToLower(s))
910+
runes[0] = []rune(strings.ToUpper(string(runes[0])))[0]
911+
return string(runes)
912+
}
913+
905914
// toMaps converts any (expected []any of map[string]any) to []map[string]any.
906915
// Falls back to JSON round-trip for typed slices (e.g., []Attachment).
907916
func toMaps(data any) []map[string]any {

0 commit comments

Comments
 (0)