app

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2026 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoConfig = errors.New("no dman config found, run: dman init <repo-url>")

ErrNoConfig is returned when the dman config file does not exist.

Functions

This section is empty.

Types

type App

type App struct {
	HomeDir     string
	HomeMode    os.FileMode
	ConfigDir   string // ~/.config/dman
	SnapshotDir string // set only when snapshots.enabled is true
}

App holds all resolved application paths.

func NewApp

func NewApp() (*App, error)

NewApp resolves all paths from the environment and returns a ready-to-use App. It creates required directories if they do not exist.

func (*App) Add

func (a *App) Add(ctx context.Context, files []string, profileFlag string, addFlag, commitFlag, pushFlag bool) error

Add copies dotfiles from the home directory into the repository. Git add/commit/push steps are configurable and can be overridden via flags.

func (*App) AddSync

func (a *App) AddSync(ctx context.Context, srcDir, profileFlag string, dryRun, addFlag, commitFlag, pushFlag bool) error

AddSync synchronizes a dotfile directory into the repository and prunes files that no longer exist in the source directory.

func (*App) Apply

func (a *App) Apply(ctx context.Context, profileFlag string, dryRun, noPull, noSnapshot bool, files []string) error

Apply pulls from remote and applies dotfiles from the repository root and the active profile overlay to home. When noPull is true the git pull is skipped. When noSnapshot is true the automatic pre-apply snapshot is skipped even if enabled in config.

func (*App) Cd

func (a *App) Cd(ctx context.Context) error

Cd starts a shell in the local repository path.

func (*App) ConfigGet

func (a *App) ConfigGet(ctx context.Context, key string) error

ConfigGet prints the value of a single config key.

func (*App) ConfigListProfiles

func (a *App) ConfigListProfiles(ctx context.Context) error

ConfigListProfiles lists the profile directories found in the dotfile repository. The active profile (from config) is prefixed with "* "; others with " ".

func (*App) ConfigSet

func (a *App) ConfigSet(ctx context.Context, key, value string) error

ConfigSet sets the value of a config key and persists the change.

func (*App) ConfigShow

func (a *App) ConfigShow(ctx context.Context) error

ConfigShow prints all settable config keys and their current values.

func (*App) ConfigUnset

func (a *App) ConfigUnset(ctx context.Context, key string) error

ConfigUnset resets a config key to its zero value and persists the change.

func (*App) Diff

func (a *App) Diff(_ context.Context, profileFlag string, files []string) error

Diff prints a unified diff between the current home file (a/) and the incoming repo version (b/) for each tracked dotfile that differs. When files is non-empty only those dotfiles are compared, using the same resolution rules as Apply. Binary files that differ are noted without showing content.

func (*App) Init

func (a *App) Init(ctx context.Context, repoURL, dest string) error

Init clones the remote dotfile repository and writes the config.

func (*App) ProfileSet

func (a *App) ProfileSet(ctx context.Context, name string) error

ProfileSet sets the active profile in config.

func (*App) Pull

func (a *App) Pull(ctx context.Context) error

Pull pulls changes from the remote repository.

func (*App) Purge

func (a *App) Purge(ctx context.Context) error

Purge removes all dman files after user confirmation.

func (*App) Push

func (a *App) Push(ctx context.Context) error

Push pushes changes to the remote repository.

func (*App) SnapshotCat

func (a *App) SnapshotCat(ctx context.Context, checksum string) error

SnapshotCat streams the blob for the given checksum to stdout.

func (*App) SnapshotCreate

func (a *App) SnapshotCreate(ctx context.Context, message string) error

SnapshotCreate captures a full snapshot of all currently tracked dotfiles.

func (*App) SnapshotDelete

func (a *App) SnapshotDelete(ctx context.Context, id string) error

SnapshotDelete removes a snapshot and reclaims unreferenced blobs.

func (*App) SnapshotList

func (a *App) SnapshotList(ctx context.Context) error

SnapshotList prints all snapshots in a table.

func (*App) SnapshotShow

func (a *App) SnapshotShow(ctx context.Context, id string) error

SnapshotShow prints the files contained in a snapshot.

func (*App) Sync added in v1.3.0

func (a *App) Sync(ctx context.Context, profileFlag string, dryRun, addFlag, commitFlag, pushFlag bool) error

Sync copies the current home versions of all tracked dotfiles back into the repository (home -> repo), honoring the active profile overlay. It is the inverse of Apply: the tracked set is defined entirely by the repository, so only files that already exist in the repo are updated. Sync never deletes; tracked files that are missing from home are skipped with a warning. When a file is tracked in both the base and the active profile, only the profile copy (the one that wins on apply) is updated.

type Config

type Config struct {
	RepositoryURL string               `json:"repositoryURL"`
	Profile       string               `json:"profile"`
	Path          string               `json:"path"`
	Snapshots     *SnapshotConfig      `json:"snapshots,omitempty"`
	Git           *GitAutomationConfig `json:"git,omitempty"`
}

Config holds the persisted dman configuration.

type GitAutomationConfig

type GitAutomationConfig struct {
	AutoAdd    bool `json:"autoAdd"`
	AutoCommit bool `json:"autoCommit"`
	AutoPush   bool `json:"autoPush"`
}

GitAutomationConfig controls which git steps run during dman add flows.

type SnapshotConfig

type SnapshotConfig struct {
	Enabled bool   `json:"enabled"`
	Path    string `json:"path,omitempty"` // default: ~/.local/state/dman/snapshots
}

SnapshotConfig controls the snapshot feature. Snapshots are enabled by default.

Jump to

Keyboard shortcuts

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