config

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Exists

func Exists() bool

Exists reports whether the configuration file at Path() exists.

func ExpandTilde

func ExpandTilde(p string) string

ExpandTilde replaces a leading "~" in p with the user's home directory. Paths that do not start with "~" are returned unchanged.

func Path

func Path() string

Path returns the default path to the configuration file. Respects $XDG_CONFIG_HOME, falls back to ~/.config/wallf/config.toml.

func Save

func Save(c Config, path string) error

Save marshals c to TOML and writes it to path. Parent directories are created as needed.

Types

type Config

type Config struct {
	General GeneralConfig `toml:"general"`
}

Config is the top-level configuration structure.

func Default

func Default() Config

Default returns a Config populated with sensible defaults.

func Load

func Load(path string) (Config, error)

Load reads a Config from path. If the file contains malformed TOML, a warning is logged and the default Config is returned (no error). Any other OS-level error (e.g. file not found) is returned as-is.

func (Config) DownloadDir

func (c Config) DownloadDir() string

DownloadDir returns the fully-expanded download directory path.

type GeneralConfig

type GeneralConfig struct {
	DownloadDir   string `toml:"download_dir"`
	DefaultSource string `toml:"default_source"`
	MinResolution string `toml:"min_resolution"`
}

GeneralConfig holds the general section of the configuration file.

type WizardDoneMsg

type WizardDoneMsg struct{ Config Config }

WizardDoneMsg is emitted when the wizard completes.

type WizardModel

type WizardModel struct {
	// contains filtered or unexported fields
}

WizardModel is the first-run setup wizard bubbletea component.

func NewWizard

func NewWizard() WizardModel

NewWizard creates a WizardModel pre-populated with defaults.

func (WizardModel) Config

func (w WizardModel) Config() Config

func (WizardModel) Done

func (w WizardModel) Done() bool

func (WizardModel) Init

func (w WizardModel) Init() tea.Cmd

func (WizardModel) Update

func (w WizardModel) Update(msg tea.Msg) (WizardModel, tea.Cmd)

func (WizardModel) View

func (w WizardModel) View() string

Jump to

Keyboard shortcuts

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