From 91cb299406d8726422876630c1f6dc4fe31e00d0 Mon Sep 17 00:00:00 2001 From: Noah Petherbridge Date: Wed, 11 Jan 2017 13:12:15 -0800 Subject: [PATCH] Update documentation to mention new command --- README.md | 29 ++++++++++++++++++++++++++++- home/bin/dfm | 3 +++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index b1e0a02..04c35ae 100644 --- a/README.md +++ b/README.md @@ -8,9 +8,36 @@ my config scripts. ```bash ~$ git clone git@github.com:kirsle/.dotfiles -~$ ./.dotfiles/setup --install +~$ ./.dotfiles/setup ``` +# Dotfiles Manager (dfm) + +The dotfiles repo is managed by a `dfm` command, which gets installed into +`~/bin` automatically. (The `.dotfiles/setup` script is just an easy alias +to this command). + +See `dfm --help` for documentation. Briefly: + +* `dfm setup` creates symlinks to all the files in `./home` into `$HOME`. +* `dfm update` does a `git pull` and installs any new dotfiles. +* `dfm check-update` reminds you every 15 days to run `dfm update` (but + doesn't remind you more than once per 24 hours). + +In case one of the target files already exists (and is not a symlink), it is +copied into `.dotfiles/backup` before being deleted and relinked. + +The commands take optional arguments: + +* `dfm setup --force`: forcefully re-link all dotfiles, deleting any links + that already exist. +* `dfm setup --copy`: tell it not to use symlinks but instead make normal + file copies into `$HOME`. +* `dfm check-update --force`: always show the update reminder. + +The `.dotfiles/setup` script passes all options along to `dfm`, so you can +do `.dotfiles/setup --copy` for example. + # Layout * `./setup` diff --git a/home/bin/dfm b/home/bin/dfm index 22d1690..2c5ca9e 100755 --- a/home/bin/dfm +++ b/home/bin/dfm @@ -267,6 +267,9 @@ sub crawl { # Existing non-link targets should be backed up. if (-f $target && !-l $target) { print "Back up existing file to: $backup\n"; + if (!-d $BACKUP) { + mkdir($BACKUP) unless $noop; + } copy($target, $backup) unless $noop; unlink($target) unless $noop; }