Documentation
¶
Overview ¶
Package hyperlink provides terminal hyperlink rendering for clog. All configuration is explicit: callers pass a Config (usually derived from the logger's FieldFormats) - the package holds no global state.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Expand ¶ added in v0.11.0
Expand resolves a preset name to its format string for the given slot ("path", "line", or "column"). Returns value unchanged if it is not a known preset name, so full format strings pass through unmodified.
func PathDisplayText ¶
PathDisplayText returns the display string for a path hyperlink.
Types ¶
type Config ¶ added in v0.11.0
type Config struct {
// Enabled controls whether hyperlinks are rendered at all. When false,
// hyperlink helpers return plain text without OSC 8 sequences.
Enabled bool
// ColumnFormat is the URL format for file+line+column hyperlinks.
// Falls back to LineFormat when empty.
ColumnFormat string
// DirFormat is the URL format for directory hyperlinks.
// Falls back to PathFormat when empty.
DirFormat string
// FileFormat is the URL format for file-only hyperlinks (no line
// number). Falls back to PathFormat when empty.
FileFormat string
// LineFormat is the URL format for file+line hyperlinks.
// Falls back to "file://{path}" when empty.
LineFormat string
// PathFormat is the generic fallback URL format for any path.
// Falls back to "file://{path}" when empty.
PathFormat string
}
Config holds resolved hyperlink rendering configuration. The format strings use {path}, {line}, and {column} (or {col}) as placeholders; an empty string means the documented fallback.
func DefaultConfig ¶ added in v0.11.0
func DefaultConfig() Config
DefaultConfig returns the default hyperlink configuration: enabled, with all format slots empty (plain file:// URLs).