Documentation
¶
Index ¶
- Variables
- type AgeConfig
- 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) Browse(ctx context.Context, profileFlag string) 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) ProfileInherit(ctx context.Context, child, parent string, clear bool) 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) SaveToRepo(ctx context.Context, name string, targets []string) 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) SnapshotRestore(ctx context.Context, id string, files []string) error
- func (a *App) SnapshotShow(ctx context.Context, id string) error
- func (a *App) Sync(ctx context.Context, profileFlag string, ...) error
- type Config
- type EncryptionConfig
- 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 AgeConfig ¶ added in v1.8.0
type AgeConfig struct {
Identity string `json:"identity,omitempty"` // path, "~/" is expanded
}
AgeConfig points at the age identity file. Its recipient is derived from the identity, so no public key has to be configured separately.
type App ¶
type App struct {
HomeDir string
HomeMode os.FileMode
ConfigDir string // ~/.config/dman
// contains filtered or unexported fields
}
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, encrypt, addFlag, commitFlag, pushFlag bool) error
Add copies dotfiles from the home directory into the repository. With encrypt the files are stored age-encrypted under the .crypt suffix; a file that is already stored encrypted stays encrypted regardless of the flag. 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, encrypt, 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. With encrypt every file in the tree is stored encrypted; files already stored encrypted stay encrypted either way.
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 " ". A profile with a parent is followed by its inheritance chain, nearest first, e.g. "arch-gridx -> arch". A broken chain is reported inline so one bad profile does not hide the others.
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) ProfileInherit ¶ added in v1.7.0
ProfileInherit declares parent as the parent of child by writing profiles/<child>/profile.json. The child directory is created when missing; the parent must exist. A declaration that would close a cycle is rolled back. With clear set, the parent declaration of child is removed.
func (*App) ProfileSet ¶
ProfileSet sets the active profile in config.
func (*App) SaveToRepo ¶ added in v1.6.0
SaveToRepo copies files from the home directory back into the repository (the reverse of Apply). Only tracked pairs whose Dst path is listed in targets are written; if targets is empty all tracked pairs are written. Git add/commit/push are performed when enabled in config, matching the behaviour of Add.
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) SnapshotRestore ¶ added in v1.7.0
SnapshotRestore writes the snapshot's version of the named files back into the home directory. Files whose current contents already match the snapshot are skipped, and everything that will actually change is snapshotted first, so a restore is itself undoable.
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"`
AddSymlinks bool `json:"addSymlinks,omitempty"`
Snapshots *SnapshotConfig `json:"snapshots,omitempty"`
Git *GitAutomationConfig `json:"git,omitempty"`
Encryption *EncryptionConfig `json:"encryption,omitempty"`
}
Config holds the persisted dman configuration.
type EncryptionConfig ¶ added in v1.8.0
type EncryptionConfig struct {
Age AgeConfig `json:"age"`
}
EncryptionConfig holds the key used for files added with --encrypt. Encryption is enabled as soon as an identity is configured; without one encrypted files are skipped on apply.
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.