render

package
v0.3.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 20, 2026 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultBorder     = '\ue0b0'
	DefaultBarBGColor = "#353533"
	DynamicWidth      = -1
)
View Source
const Version = "v1.0.0-tokei"

Variables

View Source
var (
	TableHeaderStyle = lipgloss.NewStyle().
						Bold(true).
						BorderStyle(lipgloss.ThickBorder()).
						BorderForeground(lipgloss.Color("240")).
						BorderBottom(true)

	TopHeaderStyle = lipgloss.NewStyle().
					Inherit(TableHeaderStyle).
					BorderTop(true).
					BorderStyle(lipgloss.NormalBorder())

	SelectedRowStyle = lipgloss.NewStyle().
						Foreground(lipgloss.Color("#262626")).
						Background(lipgloss.Color("#ebbd34")).
						Bold(false)
)

Functions

func Chart

func Chart(width, height, radius int, totalValue float64, raw []RawChartSector) string

Chart generates an ASCII pie chart and its legend based on the provided data.

func EntryIcon

func EntryIcon(e *structure.Entry) string

EntryIcon returns an emoji icon based on entry type and extension

func NewProgressBar

func NewProgressBar(width int, full, empty rune) progress.Model

NewProgressBar creates a custom styled progress bar (currently unused)

func NewStatusBar

func NewStatusBar(items []*BarItem, totalWidth int) string

NewStatusBar builds a status bar with the given items and total width

func Overlay

func Overlay(_ int, background, overlay string, row, col int) string

Overlay renders overlay string over background at given position

func OverlayCenter

func OverlayCenter(fullWidth, fullHeight int, background, overlay string) string

func ReportError

func ReportError(err error, stackTrace []byte) string

ReportError formats an error with stack trace and instructions for reporting

Types

type BarItem

type BarItem struct {
	// contains filtered or unexported fields
}

BarItem represents a status bar item width -1 means take all available width, shared equally with other -1 width items

func DefaultBarItem

func DefaultBarItem(content string) *BarItem

DefaultBarItem creates an item with default background color and width

func NewBarItem

func NewBarItem(content, bgColor string, width int) *BarItem

NewBarItem creates an item with specified properties

type Column

type Column struct {
	Title   string
	SortKey SortKey
	Width   int
}

func (*Column) FmtName

func (c *Column) FmtName(sortState SortState) string

FmtName adds sort indicator (▲/▼) to column title if it's the current sort key

type CycleLangFilter

type CycleLangFilter struct{}

type DirModel

type DirModel struct {
	// contains filtered or unexported fields
}

func NewDirModel

func NewDirModel(nav *Navigation) *DirModel

NewDirModel creates and initializes a directory view model.

func (*DirModel) ExitSearchMode

func (dm *DirModel) ExitSearchMode()

func (*DirModel) Init

func (dm *DirModel) Init() tea.Cmd

func (*DirModel) IsInPreviewMode added in v0.2.0

func (dm *DirModel) IsInPreviewMode() bool

IsInPreviewMode returns true if currently showing file preview

func (*DirModel) ShowFilePreview added in v0.2.0

func (dm *DirModel) ShowFilePreview(filePath string)

ShowFilePreview creates and shows a file preview

func (*DirModel) Update

func (dm *DirModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (*DirModel) View

func (dm *DirModel) View() string

type EditorFinished added in v0.3.3

type EditorFinished struct {
	Err error
}

EditorFinished represents a message that the editor has finished.

type ErrorMsg added in v0.3.3

type ErrorMsg struct {
	Err error
}

ErrorMsg represents a message containing an error.

type FilePreview added in v0.2.0

type FilePreview struct {
	// contains filtered or unexported fields
}

FilePreview represents the file preview component using viewport

func NewFilePreview added in v0.2.0

func NewFilePreview(filePath string, width, height int) *FilePreview

NewFilePreview creates a new file preview component

func (*FilePreview) GetViewportModel added in v0.2.0

func (fp *FilePreview) GetViewportModel() *viewport.Model

GetViewportModel returns the underlying viewport model for external control

func (*FilePreview) Init added in v0.2.0

func (fp *FilePreview) Init() tea.Cmd

Init initializes the file preview component

func (*FilePreview) Update added in v0.2.0

func (fp *FilePreview) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update handles key events for the file preview

func (*FilePreview) View added in v0.2.0

func (fp *FilePreview) View() string

View renders the file preview

type Mode

type Mode string
const (
	PENDING Mode = "PENDING"
	READY   Mode = "READY"
	INPUT   Mode = "INPUT"
	PREVIEW Mode = "PREVIEW"
)
const (
	SELECT_LANG Mode = "SELECT_LANG"
)
type Navigation struct {
	// contains filtered or unexported fields
}

Navigation handles traversal through the code statistics tree

func NewCodeNavigation

func NewCodeNavigation(t *structure.Tree) *Navigation
func (n *Navigation) AbsPathFromSelectedRow(selectedRow []string) string

AbsPathFromSelectedRow returns absolute path from selected row, using column 1's hidden path

func (n *Navigation) Down(name string, cursor int)
func (n *Navigation) Entry() *structure.Entry

Entry returns the current directory

func (n *Navigation) ParentTotalLines(langFilter string) int64

ParentTotalLines returns the total lines of the parent directory for calculating child entry percentages. The langFilter parameter allows getting total lines based on the currently selected language.

func (n *Navigation) Up()

type OpenFileInEditor added in v0.3.3

type OpenFileInEditor struct {
	Path string
}

OpenFileInEditor represents a message to open a file in the default editor.

type RawChartSector

type RawChartSector struct {
	Label string
	Value float64 // Using float64 to accommodate code line counts
}

RawChartSector is the raw data input for building the chart.

type ScanFinished

type ScanFinished struct{}

type SortKey

type SortKey string

type SortState

type SortState struct {
	Key  SortKey
	Desc bool
}

type ViewModel

type ViewModel struct {
	// contains filtered or unexported fields
}

func NewViewModel

func NewViewModel(n *Navigation, dirModel *DirModel) *ViewModel

func (*ViewModel) Init

func (vm *ViewModel) Init() tea.Cmd

func (*ViewModel) Update

func (vm *ViewModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (*ViewModel) View

func (vm *ViewModel) View() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL