loader

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DirName          = "toe"
	LogFileName      = "toe.log"
	WorkspaceDirName = "." + DirName
)

Variables

View Source
var (
	ErrThemeNotFound = errors.New("theme not found")
	ErrThemeCycle    = errors.New("theme inheritance cycle")
)
View Source
var ErrPathUnavailable = errors.New("path unavailable")

Functions

func AnySlice

func AnySlice(value any) ([]any, bool)

AnySlice coerces common TOML slice types to []any

func BoolPtr

func BoolPtr(value any) *bool

BoolPtr converts a TOML any value to *bool, returning nil for non-bool

func CacheDir

func CacheDir() (string, bool)

CacheDir returns the user's toe cache directory

func CanonicalPath added in v0.1.27

func CanonicalPath(path string) string

CanonicalPath resolves symlinks in path's parent directory and joins the unresolved final element

func ConfigDir

func ConfigDir() (string, bool)

ConfigDir returns the user's toe configuration directory

func ConfigFile

func ConfigFile() (string, bool)

ConfigFile returns the user's config.toml path

func ConfigIgnoreFile

func ConfigIgnoreFile() string

ConfigIgnoreFile returns the user's picker ignore-file path

func DataDir

func DataDir() (string, bool)

DataDir returns the user's toe data directory

func ExpandUserPath

func ExpandUserPath(path string) string

ExpandUserPath expands leading home-directory shorthand and environment vars

func FindWorkspace

func FindWorkspace(dir string) (string, bool)

FindWorkspace walks up for a .git or .toe directory. The bool reports a fallback to dir itself, not success

func IntPtr

func IntPtr(value any) *int

IntPtr converts a TOML any value to *int, returning nil for non-int

func LanguagesFile

func LanguagesFile() (string, bool)

LanguagesFile returns the user's languages.toml path

func LoadDefaultLanguagesTOML

func LoadDefaultLanguagesTOML() (map[string]any, bool)

LoadDefaultLanguagesTOML returns the cached bundled defaults; do not mutate

func LoadMergedTOML

func LoadMergedTOML(paths []string, depth int) (map[string]any, bool)

LoadMergedTOML overlays each readable path onto the previous ones

func LoadMergedTOMLWithBase

func LoadMergedTOMLWithBase(
	base map[string]any, paths []string, depth int,
) (map[string]any, bool)

LoadMergedTOMLWithBase merges TOML files onto an already decoded base map

func LoadThemeTOML

func LoadThemeTOML(name string) (map[string]any, error)

LoadThemeTOML reads an embedded theme, resolving its inherits chain

func LogFile

func LogFile() (string, bool)

LogFile returns the editor's log path

func MergeTOMLValues

func MergeTOMLValues(values Overlay[any], depth int) any

MergeTOMLValues overlays Over onto Base, merging maps only while depth remains; below that Over replaces Base outright

func QueryWorkspaceTrust

func QueryWorkspaceTrust(dir string, insecure bool) bool

QueryWorkspaceTrust reports whether dir's workspace may run its own config and init files; insecure trusts everything

func StringPtr

func StringPtr(value any) *string

StringPtr converts a TOML any value to *string, returning nil for non-string

func ThemeNames

func ThemeNames() []string

ThemeNames lists the embedded themes, sorted

func TrustWorkspace

func TrustWorkspace(dir string) error

TrustWorkspace adds the workspace containing dir to the trusted list

func UntrustWorkspace

func UntrustWorkspace(dir string) error

UntrustWorkspace drops the workspace containing dir from the trusted list

func WorkspaceConfigFile

func WorkspaceConfigFile(dir string) string

WorkspaceConfigFile returns the workspace config.toml path under dir

func WorkspaceInitFile added in v0.1.31

func WorkspaceInitFile(dir string) string

WorkspaceInitFile returns the workspace Ale initialization path

func WorkspaceLanguagesFile

func WorkspaceLanguagesFile(dir string) string

WorkspaceLanguagesFile returns the workspace languages.toml path under dir

func WorkspaceTrustFile

func WorkspaceTrustFile() (string, bool)

WorkspaceTrustFile returns the path of the trusted-workspace list

Types

type Overlay added in v0.2.0

type Overlay[T any] struct {
	Base T
	Over T
}

Overlay is a base value and the value layered on top of it

type WorkspaceFiles added in v0.2.0

type WorkspaceFiles struct {
	Global    string
	Workspace string
	Dir       string
}

WorkspaceFiles names a global settings file and the workspace file merged over it, alongside the directory whose trust governs that merge

Jump to

Keyboard shortcuts

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