Browse Source

Update documentation to mention new command

master
Noah Petherbridge 2 years ago
parent
commit
91cb299406
2 changed files with 31 additions and 1 deletions
  1. 28
    1
      README.md
  2. 3
    0
      home/bin/dfm

+ 28
- 1
README.md View File

@@ -8,9 +8,36 @@ my config scripts.
8 8
 
9 9
 ```bash
10 10
 ~$ git clone git@github.com:kirsle/.dotfiles
11
-~$ ./.dotfiles/setup --install
11
+~$ ./.dotfiles/setup
12 12
 ```
13 13
 
14
+# Dotfiles Manager (dfm)
15
+
16
+The dotfiles repo is managed by a `dfm` command, which gets installed into
17
+`~/bin` automatically. (The `.dotfiles/setup` script is just an easy alias
18
+to this command).
19
+
20
+See `dfm --help` for documentation. Briefly:
21
+
22
+* `dfm setup` creates symlinks to all the files in `./home` into `$HOME`.
23
+* `dfm update` does a `git pull` and installs any new dotfiles.
24
+* `dfm check-update` reminds you every 15 days to run `dfm update` (but
25
+  doesn't remind you more than once per 24 hours).
26
+
27
+In case one of the target files already exists (and is not a symlink), it is
28
+copied into `.dotfiles/backup` before being deleted and relinked.
29
+
30
+The commands take optional arguments:
31
+
32
+* `dfm setup --force`: forcefully re-link all dotfiles, deleting any links
33
+  that already exist.
34
+* `dfm setup --copy`: tell it not to use symlinks but instead make normal
35
+  file copies into `$HOME`.
36
+* `dfm check-update --force`: always show the update reminder.
37
+
38
+The `.dotfiles/setup` script passes all options along to `dfm`, so you can
39
+do `.dotfiles/setup --copy` for example.
40
+
14 41
 # Layout
15 42
 
16 43
 * `./setup`

+ 3
- 0
home/bin/dfm View File

@@ -267,6 +267,9 @@ sub crawl {
267 267
         # Existing non-link targets should be backed up.
268 268
         if (-f $target && !-l $target) {
269 269
             print "Back up existing file to: $backup\n";
270
+            if (!-d $BACKUP) {
271
+                mkdir($BACKUP) unless $noop;
272
+            }
270 273
             copy($target, $backup) unless $noop;
271 274
             unlink($target) unless $noop;
272 275
         }

Loading…
Cancel
Save