diff --git a/docs/usage.md b/docs/usage.md index 5d75928..2cbf1ec 100644 --- a/docs/usage.md +++ b/docs/usage.md @@ -31,7 +31,7 @@ It can be changed: The `import` command imports dotfiles to be managed by dotdrop. It copies the dotfile to your `dotpath` and updates the config file with the new entry. -Note that dotdrop will dereference all symlinks when importing a file or directory. +Dotdrop will ask for dereferencing symlinks on import unless `-f --force` is used. For example to import `~/.xinitrc` ```bash diff --git a/dotdrop/dotdrop.py b/dotdrop/dotdrop.py index a12fd40..8189788 100644 --- a/dotdrop/dotdrop.py +++ b/dotdrop/dotdrop.py @@ -374,6 +374,14 @@ def cmd_importer(o): dst = path.rstrip(os.sep) dst = os.path.abspath(dst) + if o.safe: + # ask for symlinks + realdst = os.path.realpath(dst) + if dst != realdst: + msg = '\"{}\" is a symlink, dereference it and continue?' + if not LOG.ask(msg.format(dst)): + continue + src = strip_home(dst) if o.import_as: # handle import as