Documentation
¶
Index ¶
- Constants
- Variables
- func FormatFileSize(size int64) string
- func FormatRelativeTime(timestamp int64) string
- func FormatTime(timestamp int64) string
- func GetFilePreview(path string, maxLines int) string
- func HighlightCode(code string, filename string) (string, error)
- func IsBinary(content []byte) bool
- func RestoreTTY(origStdoutFd int)
- func SetupTTY() (origStdoutFd int, err error)
Constants ¶
View Source
const ( // BinaryDetectionBytes is the number of bytes to read for binary detection BinaryDetectionBytes = 8192 // MaxPreviewLines is the maximum number of lines to show in file preview MaxPreviewLines = 50 // MaxLineLength is the maximum character length for a single line MaxLineLength = 120 // MaxDirectoryEntries is the maximum number of directory entries to show MaxDirectoryEntries = 20 // HistoryContextLinesBefore is the number of history context lines before HistoryContextLinesBefore = 3 // HistoryContextLinesAfter is the number of history context lines after HistoryContextLinesAfter = 4 )
Binary detection and preview constants
View Source
const ( ColorCyan = "#7dcfff" ColorPurple = "#bb9af7" ColorForeground = "#c0caf5" ColorYellow = "#e0af68" ColorOrange = "#ff9e64" ColorComment = "#9aa5ce" ColorBlue = "#7aa2f7" ColorPink = "#f7768e" // Tokyo Night pink/magenta for highlights ColorSelectionBg = "#414868" // Tokyo Night selection color for better visibility ColorBorder = "#565f89" // Tokyo Night gray for borders ColorTimeAgo = "#7aa2f7" // Blue-ish gray for time ago display )
Tokyo Night color palette
Variables ¶
View Source
var ( HeaderStyle = lipgloss.NewStyle(). Foreground(lipgloss.Color(ColorCyan)). Bold(true). Underline(true) LabelStyle = lipgloss.NewStyle(). Foreground(lipgloss.Color(ColorPurple)) ContentStyle = lipgloss.NewStyle(). Foreground(lipgloss.Color(ColorForeground)) ContextHeaderStyle = lipgloss.NewStyle(). Foreground(lipgloss.Color(ColorYellow)). Bold(true) ActiveContextStyle = lipgloss.NewStyle(). Foreground(lipgloss.Color(ColorOrange)). Bold(true) InactiveContextStyle = lipgloss.NewStyle(). Foreground(lipgloss.Color(ColorComment)) )
Styles for preview window and TUI elements
Functions ¶
func FormatFileSize ¶
FormatFileSize formats a file size in bytes to a human-readable string
func FormatRelativeTime ¶
FormatRelativeTime formats a Unix timestamp as a human-readable relative time
func FormatTime ¶
FormatTime formats a Unix timestamp as YYYY-MM-DD HH:MM:SS
func GetFilePreview ¶
GetFilePreview returns a preview of the file contents with syntax highlighting
func HighlightCode ¶
HighlightCode performs syntax highlighting on code
func RestoreTTY ¶
func RestoreTTY(origStdoutFd int)
RestoreTTY restores stdout to the original file descriptor
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.