config

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigDir

func ConfigDir() (string, error)

ConfigDir returns the fur configuration directory. Migrates from the legacy ~/.config/lookit path if it exists.

func CreateDefault

func CreateDefault() (string, error)

CreateDefault writes a default config file to ~/.config/fur/config.yaml if one does not already exist. Returns the path written, or empty string if a config already exists.

func Watch

func Watch(cfgFile string, onChange func(*Config))

Watch starts watching the config file for changes and reloads on modification. The onChange callback is invoked with the new config after each successful reload.

Types

type Config

type Config struct {
	// Root directory to browse
	Root string `mapstructure:"root"`

	// Theme: light, dark, or auto
	Theme string `mapstructure:"theme"`

	// Keymap preset: default, vim, emacs
	Keymap string `mapstructure:"keymap"`

	// Web server settings
	Server ServerConfig `mapstructure:"server"`

	// Git integration settings
	Git GitConfig `mapstructure:"git"`

	// File patterns to ignore (in addition to .gitignore)
	Ignore []string `mapstructure:"ignore"`

	// Mouse enables mouse wheel scrolling in TUI
	Mouse bool `mapstructure:"mouse"`

	// ReadingGuide shows a full-row highlight on the cursor line
	ReadingGuide bool `mapstructure:"reading_guide"`

	// ScrollOff keeps this many lines visible above/below the cursor
	ScrollOff int `mapstructure:"scrolloff"`

	// Debug enables verbose logging
	Debug bool `mapstructure:"debug"`

	// Remote holds named remote host configurations
	Remotes map[string]RemoteConfig `mapstructure:"remotes"`
}

Config holds all application configuration.

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns configuration with sensible defaults.

func Load

func Load(cfgFile string) (*Config, error)

Load reads configuration from file and environment, merging with defaults.

func (*Config) String

func (c *Config) String() string

String returns a human-readable representation of the config for debugging.

func (*Config) Validate

func (c *Config) Validate() error

Validate checks that config values are within allowed ranges.

type GitConfig

type GitConfig struct {
	Enabled    bool   `mapstructure:"enabled"`
	ShowStatus bool   `mapstructure:"show_status"`
	Remote     string `mapstructure:"remote"`
}

GitConfig holds git integration settings.

type RecentFiles

type RecentFiles struct {
	Files []string `json:"files"`
	// contains filtered or unexported fields
}

RecentFiles manages a persistent list of recently opened files.

func LoadRecentFiles

func LoadRecentFiles() *RecentFiles

LoadRecentFiles reads the recent files list from disk.

func (*RecentFiles) Add

func (r *RecentFiles) Add(path string)

Add puts a file at the front of the recent list, removing duplicates.

func (*RecentFiles) Save

func (r *RecentFiles) Save() error

Save writes the recent files list to disk.

type RemoteConfig

type RemoteConfig struct {
	Host string `mapstructure:"host"`
	User string `mapstructure:"user"`
	Port int    `mapstructure:"port"`
	Path string `mapstructure:"path"`
}

RemoteConfig defines a named remote host for SSH browsing.

type ServerConfig

type ServerConfig struct {
	Port      int    `mapstructure:"port"`
	Host      string `mapstructure:"host"`
	NoHTTPS   bool   `mapstructure:"no_https"`
	Open      bool   `mapstructure:"open"`
	CustomCSS string `mapstructure:"custom_css"`
}

ServerConfig holds web server settings.

Jump to

Keyboard shortcuts

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