Documentation
¶
Index ¶
- Constants
- Variables
- func CodeFenceLanguageFromPath(path string) string
- func Colorize(color, text string) string
- func ColorizeCode(code string) string
- func ColorizeDiff(diff string) string
- func ColorsEnabled() bool
- func CreateHyperlink(url, text string) string
- func EmojiText(emojiText, plainText string) string
- func RenderMarkdown(text string) (string, error)
- func SelectFromList[T any](items []T, renderer ItemRenderer[T]) (T, error)
- func SelectFromListWithAction[T any](items []T, renderer ItemRenderer[T], customAction CustomAction[T], ...) (T, error)
- func SelectPR(prs []*github.PullRequest) (*github.PullRequest, error)
- func SetColorEnabled(enabled bool)
- func StripSuggestionBlock(body string) string
- func WrapText(text string, width int) string
- type AuthorStyle
- type CommentListStyle
- type CustomAction
- type ItemRenderer
- type ReviewListStyle
- func (rls *ReviewListStyle) FormatCommentDescription(filePath string, lineNumber int) string
- func (rls *ReviewListStyle) FormatCommentTitle(commentID int64) string
- func (rls *ReviewListStyle) FormatSuggestionDescription(hasSuggestion bool, isOutdated bool) string
- func (rls *ReviewListStyle) FormatSuggestionTitle(filePath string, lineNumber int) string
- type SelectionModel
- type StatusStyle
- type SuggestionListStyle
Constants ¶
const ( ColorReset = "\033[0m" ColorRed = "\033[31m" ColorGreen = "\033[32m" ColorYellow = "\033[33m" ColorCyan = "\033[36m" ColorGray = "\033[90m" )
Variables ¶
var ErrNoSelection = errors.New("no selection made")
Functions ¶
func CodeFenceLanguageFromPath ¶ added in v1.1.0
CodeFenceLanguageFromPath returns a glamour-friendly language identifier derived from a file path extension. An empty string means "no preference".
func ColorizeCode ¶
ColorizeCode applies syntax highlighting to suggested code
func ColorizeDiff ¶
ColorizeDiff applies syntax highlighting to diff hunks
func ColorsEnabled ¶ added in v1.1.0
func ColorsEnabled() bool
ColorsEnabled reports whether ANSI colors are enabled.
func CreateHyperlink ¶
CreateHyperlink creates an OSC8 hyperlink
func EmojiText ¶ added in v1.1.0
EmojiText returns emojiText when colors/emoji are enabled, otherwise the plain fallback.
func RenderMarkdown ¶
RenderMarkdown renders markdown text with glamour
func SelectFromList ¶
func SelectFromList[T any](items []T, renderer ItemRenderer[T]) (T, error)
SelectFromList creates an interactive selector for a list of items Returns selected items in order they were selected
func SelectFromListWithAction ¶
func SelectFromListWithAction[T any](items []T, renderer ItemRenderer[T], customAction CustomAction[T], actionKey string, onOpen CustomAction[T], filterFunc func(T, bool) bool, onSelect CustomAction[T], customActionSecond CustomAction[T], actionKeySecond string) (T, error)
SelectFromListWithAction creates an interactive selector with a custom action The customAction is triggered by r, and actionKey describes the action in the help text
func SelectPR ¶ added in v1.2.0
func SelectPR(prs []*github.PullRequest) (*github.PullRequest, error)
SelectPR displays an interactive selector for choosing a pull request
func SetColorEnabled ¶ added in v1.1.0
func SetColorEnabled(enabled bool)
SetColorEnabled toggles ANSI color output across the UI helpers.
func StripSuggestionBlock ¶
StripSuggestionBlock removes the suggestion code block and images from comment body
Types ¶
type AuthorStyle ¶
type AuthorStyle struct {
Name string // Author name (without @ symbol)
IsBot bool // True if author name ends with [bot]
Color string // ANSI color code (cyan for users, yellow for bots)
}
AuthorStyle represents styling information for a GitHub author.
func NewAuthorStyle ¶
func NewAuthorStyle(author string) *AuthorStyle
NewAuthorStyle creates a new author style based on the author name. Bots (ending with [bot]) are colored yellow, regular users in cyan.
func (*AuthorStyle) Format ¶
func (as *AuthorStyle) Format(includeIcon bool) string
Format returns the formatted author string with color (colored "@authorname").
type CommentListStyle ¶
type CommentListStyle = ReviewListStyle
CommentListStyle is an alias for backward compatibility with resolve.go.
func NewCommentListStyle ¶
func NewCommentListStyle(authorName string, isResolved bool) *CommentListStyle
NewCommentListStyle creates a new comment list style from comment data. Deprecated: Use NewReviewListStyle instead.
type CustomAction ¶
CustomAction is a function that handles custom actions on items
type ItemRenderer ¶
type ItemRenderer[T any] interface { // Title returns the primary display text for an item Title(item T) string // Description returns secondary text for an item Description(item T) string // Preview returns detailed preview text for an item Preview(item T) string // EditPath returns the file path to open in editor (optional) EditPath(item T) string // EditLine returns the line number to go to in editor (1-based, optional) EditLine(item T) int // FilterValue returns the string to match against when filtering FilterValue(item T) string // IsSkippable returns true if the item should be skipped during navigation IsSkippable(item T) bool }
ItemRenderer defines how to render an item in the selector
type ReviewListStyle ¶
type ReviewListStyle struct {
Author *AuthorStyle // Author styling (with bot detection)
Status *StatusStyle // Resolution status styling
}
ReviewListStyle provides formatting for list items showing review comments or suggestions.
func NewReviewListStyle ¶
func NewReviewListStyle(authorName string, isResolved bool) *ReviewListStyle
NewReviewListStyle creates a new review list style from comment data.
func (*ReviewListStyle) FormatCommentDescription ¶
func (rls *ReviewListStyle) FormatCommentDescription(filePath string, lineNumber int) string
FormatCommentDescription returns a formatted description for comment list: "file:line [emoji status]".
func (*ReviewListStyle) FormatCommentTitle ¶
func (rls *ReviewListStyle) FormatCommentTitle(commentID int64) string
FormatCommentTitle returns a formatted title for comment list display: "@author".
func (*ReviewListStyle) FormatSuggestionDescription ¶
func (rls *ReviewListStyle) FormatSuggestionDescription(hasSuggestion bool, isOutdated bool) string
FormatSuggestionDescription returns a formatted description with status and tags for suggestion list.
func (*ReviewListStyle) FormatSuggestionTitle ¶
func (rls *ReviewListStyle) FormatSuggestionTitle(filePath string, lineNumber int) string
FormatSuggestionTitle returns a formatted title for suggestion list: "@author • file:line".
type SelectionModel ¶
type SelectionModel[T any] struct { // contains filtered or unexported fields }
SelectionModel is the tea.Model for interactive selection
func (*SelectionModel[T]) Init ¶
func (m *SelectionModel[T]) Init() tea.Cmd
Init initializes the model
type StatusStyle ¶
type StatusStyle struct {
IsResolved bool // True if resolved, false if unresolved
Label string // "resolved" or "unresolved"
Color string // ANSI color code (green for resolved, yellow for unresolved)
Emoji string // Visual indicator (✅ or ⚠️)
}
StatusStyle represents styling information for resolved/unresolved status.
func NewStatusStyle ¶
func NewStatusStyle(isResolved bool) *StatusStyle
NewStatusStyle creates a new status style for the given resolved state.
func (*StatusStyle) Format ¶
func (ss *StatusStyle) Format(includeEmoji bool) string
Format returns the formatted status string with color and emoji. When includeEmoji is true, the emoji indicator is prepended to the status.
type SuggestionListStyle ¶
type SuggestionListStyle = ReviewListStyle
SuggestionListStyle is an alias for backward compatibility with applier.go.
func NewSuggestionListStyle ¶
func NewSuggestionListStyle(authorName string, isResolved bool) *SuggestionListStyle
NewSuggestionListStyle creates a new suggestion list style from comment data. Deprecated: Use NewReviewListStyle instead.