profile

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package profile resolves the layout and inheritance of profiles inside a dotfile repository. A profile is a directory under profiles/<name>. It may carry a profile.json declaring a parent profile; the effective file set of a profile is the repository root, then every ancestor from the top down, then the profile itself, with later layers overriding earlier ones.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Chain

func Chain(repo, name string) ([]string, error)

Chain resolves the inheritance chain of name, ordered from the root-most ancestor to name itself. A profile without a directory is returned as a single-element chain so callers can keep their base-only fallback. A declared parent whose directory is missing, or a cycle, is an error.

func Dir

func Dir(repo, name string) string

Dir returns the directory inside repo where files for the given profile are stored. An empty name maps to the repository root (base); any named profile maps under profiles/<name>.

func Exists

func Exists(repo, name string) bool

Exists reports whether the profile directory is present in repo.

func List

func List(repo string) ([]string, error)

List returns the names of all profile directories in repo, sorted. A missing profiles/ directory yields nil and no error.

func Parents

func Parents(repo, name string) ([]string, error)

Parents returns the ancestors of name, nearest first, or nil when name has no parent. It is a convenience over Chain for display purposes.

func Root

func Root(repo string) string

Root returns the profiles/ directory of repo.

func WriteMeta

func WriteMeta(repo, name string, m Meta) error

WriteMeta writes profiles/<name>/profile.json, creating the profile directory if needed. A zero Meta removes the file instead.

Types

type Meta

type Meta struct {
	Inherits string `json:"inherits,omitempty"`
}

Meta is the content of profiles/<name>/profile.json.

func ReadMeta

func ReadMeta(repo, name string) (Meta, error)

ReadMeta reads profiles/<name>/profile.json. A missing file yields a zero Meta and no error.

func (Meta) IsZero

func (m Meta) IsZero() bool

IsZero reports whether the metadata carries no settings.

Jump to

Keyboard shortcuts

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