1
1
mirror of https://gitea.com/gitea/tea synced 2025-08-29 17:21:48 +02:00
tea/modules/print/release.go
Lunny Xiao 2ddb3bd4a1 Add Zip URL for release list (#788)
Fix #780

Reviewed-on: https://gitea.com/gitea/tea/pulls/788
Reviewed-by: techknowlogick <techknowlogick@noreply.gitea.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2025-08-11 18:43:34 +00:00

38 lines
707 B
Go

// Copyright 2020 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package print
import (
"code.gitea.io/sdk/gitea"
)
// ReleasesList prints a listing of releases
func ReleasesList(releases []*gitea.Release, output string) {
t := tableWithHeader(
"Tag-Name",
"Title",
"Published At",
"Status",
"Tar/Zip URL",
)
for _, release := range releases {
status := "released"
if release.IsDraft {
status = "draft"
} else if release.IsPrerelease {
status = "prerelease"
}
t.addRow(
release.TagName,
release.Title,
FormatTime(release.PublishedAt, isMachineReadable(output)),
status,
release.TarURL+"\n"+release.ZipURL,
)
}
t.print(output)
}