From aa7f5bcf38129f79bb08c4e1f396647807fe8fef Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Fri, 27 Mar 2026 11:16:48 +0200 Subject: Use Go 1.21 max builtin in formatter --- internal/askcli/formatter.go | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) (limited to 'internal') diff --git a/internal/askcli/formatter.go b/internal/askcli/formatter.go index a181c1a..0e7edfc 100644 --- a/internal/askcli/formatter.go +++ b/internal/askcli/formatter.go @@ -46,13 +46,13 @@ func taskListWidthsFor(tasks []TaskExport, aliases map[string]string, terminalWi } longestDescription := widths.Description for _, t := range tasks { - widths.Urgency = maxInt(widths.Urgency, len(fmt.Sprintf("%.1f", t.Urgency))) - widths.Priority = maxInt(widths.Priority, len(t.Priority)) - widths.ID = maxInt(widths.ID, len(displayTaskAlias(t.UUID, aliases))) - widths.Status = maxInt(widths.Status, len(t.Status)) - widths.Started = maxInt(widths.Started, len(formatTaskStarted(t))) - widths.Tags = maxInt(widths.Tags, len(formatTaskTags(t.Tags))) - longestDescription = maxInt(longestDescription, len(t.Description)) + widths.Urgency = max(widths.Urgency, len(fmt.Sprintf("%.1f", t.Urgency))) + widths.Priority = max(widths.Priority, len(t.Priority)) + widths.ID = max(widths.ID, len(displayTaskAlias(t.UUID, aliases))) + widths.Status = max(widths.Status, len(t.Status)) + widths.Started = max(widths.Started, len(formatTaskStarted(t))) + widths.Tags = max(widths.Tags, len(formatTaskTags(t.Tags))) + longestDescription = max(longestDescription, len(t.Description)) } widths.Description = taskListDescriptionWidth(widths, terminalWidth, longestDescription) return widths @@ -111,13 +111,6 @@ func formatTaskStarted(t TaskExport) string { return "yes" } -func maxInt(a, b int) int { - if a > b { - return a - } - return b -} - func taskListDescriptionWidth(widths taskListWidths, terminalWidth, longestDescription int) int { if terminalWidth <= 0 { return longestDescription -- cgit v1.2.3