Documentation
¶
Index ¶
- func ClearScreen()
- func FormatCommandMessage(command string) string
- func FormatCountMessage(message string) string
- func FormatError(err CompilerError) string
- func FormatErrorMessage(message string) string
- func FormatFileSize(size int64) string
- func FormatInfoMessage(message string) string
- func FormatListHeader(header string) string
- func FormatListItem(item string) string
- func FormatLocationMessage(message string) string
- func FormatNumber(n int) string
- func FormatProgressMessage(message string) string
- func FormatPromptMessage(message string) string
- func FormatSuccessMessage(message string) string
- func FormatVerboseMessage(message string) string
- func FormatWarningMessage(message string) string
- func RenderStruct(v interface{}) string
- func RenderTable(config TableConfig) string
- func RenderTableAsJSON(config TableConfig) (string, error)
- func ToRelativePath(path string) string
- type CompilerError
- type ErrorPosition
- type SpinnerWrapper
- type TableConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClearScreen ¶ added in v0.22.0
func ClearScreen()
ClearScreen clears the terminal screen if stdout is a TTY Uses ANSI escape codes for cross-platform compatibility
func FormatCommandMessage ¶
FormatCommandMessage formats a command execution message
func FormatCountMessage ¶
FormatCountMessage formats a count/numeric status message
func FormatError ¶
func FormatError(err CompilerError) string
FormatError formats a CompilerError with Rust-like rendering
func FormatErrorMessage ¶
FormatErrorMessage formats a simple error message (for stderr output)
func FormatFileSize ¶ added in v0.28.3
FormatFileSize formats file sizes in a human-readable way (e.g., "1.2 KB", "3.4 MB")
func FormatInfoMessage ¶
FormatInfoMessage formats an informational message
func FormatListHeader ¶
FormatListHeader formats a section header for lists
func FormatListItem ¶
FormatListItem formats an item in a list
func FormatLocationMessage ¶
FormatLocationMessage formats a file/directory location message
func FormatNumber ¶ added in v0.26.0
FormatNumber formats large numbers in a human-readable way (e.g., "1k", "1.2k", "1.12M")
func FormatProgressMessage ¶
FormatProgressMessage formats a progress/activity message
func FormatPromptMessage ¶
FormatPromptMessage formats a user prompt message
func FormatSuccessMessage ¶
FormatSuccessMessage formats a success message with styling
func FormatVerboseMessage ¶
FormatVerboseMessage formats verbose debugging output
func FormatWarningMessage ¶
FormatWarningMessage formats a warning message
func RenderStruct ¶ added in v0.21.0
func RenderStruct(v interface{}) string
RenderStruct renders a Go struct to console output using reflection and struct tags. It supports: - Rendering structs as markdown-style headers with key-value pairs - Rendering slices as tables using the console table renderer - Rendering maps as markdown headers
Struct tags: - `console:"title:My Title"` - Sets the title for a section - `console:"header:Column Name"` - Sets the column header name for table columns - `console:"omitempty"` - Skips zero values - `console:"-"` - Skips the field entirely
func RenderTable ¶
func RenderTable(config TableConfig) string
RenderTable renders a formatted table using lipgloss
func RenderTableAsJSON ¶ added in v0.20.0
func RenderTableAsJSON(config TableConfig) (string, error)
RenderTableAsJSON renders a table configuration as JSON This converts the table structure to a JSON array of objects
func ToRelativePath ¶
ToRelativePath converts an absolute path to a relative path from the current working directory
Types ¶
type CompilerError ¶
type CompilerError struct {
Position ErrorPosition
Type string // "error", "warning", "info"
Message string
Context []string // Source code lines for context
Hint string // Optional hint for fixing the error
}
CompilerError represents a structured compiler error with position information
type ErrorPosition ¶
ErrorPosition represents a position in a source file
type SpinnerWrapper ¶
type SpinnerWrapper struct {
// contains filtered or unexported fields
}
SpinnerWrapper wraps the spinner functionality with TTY detection
func NewSpinner ¶
func NewSpinner(message string) *SpinnerWrapper
NewSpinner creates a new spinner with the given message The spinner is automatically disabled when not running in a TTY
func (*SpinnerWrapper) IsEnabled ¶
func (s *SpinnerWrapper) IsEnabled() bool
IsEnabled returns whether the spinner is enabled (i.e., running in a TTY)
func (*SpinnerWrapper) UpdateMessage ¶
func (s *SpinnerWrapper) UpdateMessage(message string)
UpdateMessage updates the spinner message