print issue prettier
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"text/tabwriter"
|
"text/tabwriter"
|
||||||
|
|
||||||
|
"charm.land/lipgloss/v2"
|
||||||
"github.com/muesli/reflow/truncate"
|
"github.com/muesli/reflow/truncate"
|
||||||
"github.com/steveyegge/beads"
|
"github.com/steveyegge/beads"
|
||||||
)
|
)
|
||||||
@@ -80,15 +81,26 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func IssueString(issue Issue) string {
|
func IssueString(issue Issue) string {
|
||||||
return fmt.Sprintf(
|
labelStyle := lipgloss.NewStyle().
|
||||||
"ID: %s\nTitle: %s\nDescription: %s\nStatus: %s\nType: %s\nPriority: %d",
|
Bold(true).Foreground(lipgloss.Color("5"))
|
||||||
issue.ID,
|
|
||||||
issue.Title,
|
titleStyle := lipgloss.NewStyle().
|
||||||
issue.Description,
|
Bold(true).Foreground(lipgloss.Color("6"))
|
||||||
issue.Status,
|
|
||||||
issue.IssueType,
|
boxStyle := lipgloss.NewStyle().Padding(1)
|
||||||
issue.Priority,
|
|
||||||
|
line := func(label, value string) string {
|
||||||
|
return labelStyle.Render(label) + ": " + value + "\t"
|
||||||
|
}
|
||||||
|
|
||||||
|
content := lipgloss.JoinVertical(
|
||||||
|
lipgloss.Left,
|
||||||
|
line("Title", titleStyle.Render(issue.Title)+"\t"+line("Assignee", issue.Assignee)),
|
||||||
|
line("ID", issue.ID+"\t"+line("Type", string(issue.IssueType))+line("Status", string(issue.Status))+line("Priority", fmt.Sprintf("%d", issue.Priority))),
|
||||||
|
line("Description", "\n"+issue.Description),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
return boxStyle.Render(content)
|
||||||
}
|
}
|
||||||
|
|
||||||
func IssuesPtrToIssues(issuePtr []*Issue) []Issue {
|
func IssuesPtrToIssues(issuePtr []*Issue) []Issue {
|
||||||
|
|||||||
Reference in New Issue
Block a user