diff options
| author | Paul Buetow <paul@buetow.org> | 2026-03-27 11:16:48 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-03-27 11:16:48 +0200 |
| commit | aa7f5bcf38129f79bb08c4e1f396647807fe8fef (patch) | |
| tree | 338e0b777c2d286843bf4b9a009053795865b89c /internal | |
| parent | 4732a59111d161232f466e9122c01fe5fc6cf80e (diff) | |
Use Go 1.21 max builtin in formatter
Diffstat (limited to 'internal')
| -rw-r--r-- | internal/askcli/formatter.go | 21 |
1 files changed, 7 insertions, 14 deletions
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 |
