1
0
Fork 0
mirror of https://gitea.com/gitea/tea.git synced 2026-04-01 16:20:06 +02:00
tea/modules/print/label.go
techknowlogick b05e03416b replace log.Fatal/os.Exit with error returns (#941)
* Use stdlib encoders
* Reduce some duplication
* Remove global pagination state
* Dedupe JSON detail types
* Bump golangci-lint

Reviewed-on: https://gitea.com/gitea/tea/pulls/941
Co-authored-by: techknowlogick <techknowlogick@gitea.com>
Co-committed-by: techknowlogick <techknowlogick@gitea.com>
2026-03-27 03:36:44 +00:00

30 lines
550 B
Go

// Copyright 2020 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package print
import (
"strconv"
"code.gitea.io/sdk/gitea"
)
// LabelsList prints a listing of labels
func LabelsList(labels []*gitea.Label, output string) error {
t := tableWithHeader(
"Index",
"Color",
"Name",
"Description",
)
for _, label := range labels {
t.addRow(
strconv.FormatInt(label.ID, 10),
formatLabel(label, !isMachineReadable(output), label.Color),
label.Name,
label.Description,
)
}
return t.print(output)
}