Documentation
¶
Index ¶
- Variables
- type App
- func (a *App) Add(ctx context.Context, files []string, profileFlag string, ...) error
- func (a *App) AddSync(ctx context.Context, srcDir, profileFlag string, ...) error
- func (a *App) Apply(ctx context.Context, profileFlag string, dryRun, noPull, noSnapshot bool, ...) error
- func (a *App) Cd(ctx context.Context) error
- func (a *App) ConfigGet(ctx context.Context, key string) error
- func (a *App) ConfigListProfiles(ctx context.Context) error
- func (a *App) ConfigSet(ctx context.Context, key, value string) error
- func (a *App) ConfigShow(ctx context.Context) error
- func (a *App) ConfigUnset(ctx context.Context, key string) error
- func (a *App) Diff(_ context.Context, profileFlag string, files []string) error
- func (a *App) Init(ctx context.Context, repoURL, dest string) error
- func (a *App) ProfileSet(ctx context.Context, name string) error
- func (a *App) Pull(ctx context.Context) error
- func (a *App) Purge(ctx context.Context) error
- func (a *App) Push(ctx context.Context) error
- func (a *App) SnapshotCat(ctx context.Context, checksum string) error
- func (a *App) SnapshotCreate(ctx context.Context, message string) error
- func (a *App) SnapshotDelete(ctx context.Context, id string) error
- func (a *App) SnapshotList(ctx context.Context) error
- func (a *App) SnapshotShow(ctx context.Context, id string) error
- func (a *App) Sync(ctx context.Context, profileFlag string, ...) error
- type Config
- type GitAutomationConfig
- type SnapshotConfig
Constants ¶
This section is empty.
Variables ¶
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 ¶
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) ConfigListProfiles ¶
ConfigListProfiles lists the profile directories found in the dotfile repository. The active profile (from config) is prefixed with "* "; others with " ".
func (*App) ConfigShow ¶
ConfigShow prints all settable config keys and their current values.
func (*App) ConfigUnset ¶
ConfigUnset resets a config key to its zero value and persists the change.
func (*App) Diff ¶
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) ProfileSet ¶
ProfileSet sets the active profile in config.
func (*App) SnapshotCat ¶
SnapshotCat streams the blob for the given checksum to stdout.
func (*App) SnapshotCreate ¶
SnapshotCreate captures a full snapshot of all currently tracked dotfiles.
func (*App) SnapshotDelete ¶
SnapshotDelete removes a snapshot and reclaims unreferenced blobs.
func (*App) SnapshotList ¶
SnapshotList prints all snapshots in a table.
func (*App) SnapshotShow ¶
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.