// Data and interface definitions for bugs package buggo import ( "fmt" "github.com/charmbracelet/lipgloss" ) type Bug struct { Title string // The title of the bug in human readable format Description string // The description of the bug Status string // The status of the bug Tags []Tag // A slice of [buggo.Tag] structs Blockedby []Blocker // A slice of [buggo.Blocker] structs path string // The path to the bug machineTitle string // The machine parseable bug title } type ( Tag string // A string representing a single tag Blocker string // A string representing a single blocker ) // Reads a bug from disk // func (b Bug) Read() (bug Bug, err error) { return Bug{}, nil } // Writes a bug to disk func (b Bug) Write() (success bool, err error) { return false, nil } // Removes a bug from disk func (b Bug) Delete() (success bool, err error) { return false, nil } // Renders a bug as text func (b Bug) View() string { headerStyle := lipgloss.NewStyle(). Width(120). Foreground(lipgloss.Color("#00FF00")) subtitleStyle := lipgloss.NewStyle(). Width(120). Faint(true). Underline(true). Italic(true) tagsStyle := lipgloss.NewStyle(). Width(50). Italic(true) var tags string for _, tag := range b.Tags { tags = tags + string(tag) + ", " } var blockers string for _, blocker := range b.Blockedby { blockers = blockers + string(blocker) + ", " } return fmt.Sprintf("%s\n\n%s\n---\nTags:\t%s\nBlockedby:\t%s\n---\n%s", headerStyle.Render(b.Title), subtitleStyle.Render("status:\t"+b.Status), tagsStyle.Render(tags), tagsStyle.Render(blockers), b.Description, ) }