Documentation
¶
Overview ¶
internal/config/config.go
internal/config/flags.go
Index ¶
Constants ¶
const AppName = "tide"
Base application details
const ConfigDirName = "tide"
const DefaultConfigFileName = "config.toml" // Main config file
const DefaultLeaderKey = ','
Input Behavior
const DefaultLogFileName = "tide.log"
const DefaultScrollOff = 3
const DefaultTabWidth = 4
These could be moved to NewDefaultConfig(), keeping here for now
const DefaultThemeFileName = "theme.toml" // Active theme file
const LeaderTimeout = 500 * time.Millisecond
const MessageTimeout = 4 * time.Second
Status Bar
const StatusBarHeight = 1
UI Layout
const SystemClipboard = true
const ThemesDirName = "themes"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Logger logger.Config `toml:"logger"` // Embed logger config under [logger] table
Editor EditorConfig `toml:"editor"` // Editor-specific settings
Plugins map[string]map[string]interface{} `toml:"plugins"` // Holds plugin configurations
}
Config holds the application's combined configuration.
func Get ¶
func Get() *Config
Get returns the loaded application configuration. Panics if LoadConfig wasn't called.
func LoadConfig ¶
LoadConfig orchestrates loading defaults, file, applying flags, and validation. It should be called only once, typically from main.
func NewDefaultConfig ¶
func NewDefaultConfig() *Config
NewDefaultConfig creates a Config struct with default values.
type EditorConfig ¶
type EditorConfig struct {
TabWidth int `toml:"tab_width"`
ScrollOff int `toml:"scroll_off"`
SystemClipboard bool `toml:"system_clipboard"`
StatusBarHeight int `toml:"status_bar_height"` // Add StatusBarHeight
}
EditorConfig holds editor-specific settings.
type Flags ¶
type Flags struct {
ConfigFilePath *string
Version *bool
LogLevel *string
LogFilePath *string
TabWidth *int
ScrollOff *int
// Add flags for logger filters
EnableTags *string
DisableTags *string
EnablePkgs *string
DisablePkgs *string
EnableFiles *string
DisableFiles *string
DebugLog *bool
SystemClipboard *bool
}
Flags holds values parsed from command-line flags. Use pointers to distinguish between unset flags and zero-value flags.
func (*Flags) ApplyOverrides ¶
ApplyOverrides updates the Config struct with values from flags *if* they were set.
func (*Flags) DefineFlags ¶
func (f *Flags) DefineFlags()
DefineFlags sets up the command-line flags and associates them with the Flags struct fields.
func (*Flags) ParseFlags ¶
ParseFlags parses the defined command-line flags into the Flags struct. It returns the remaining non-flag arguments (e.g., the file path).