deadc0de6 / dotdrop

Save your dotfiles once, deploy them everywhere
https://dotdrop.readthedocs.io
GNU General Public License v3.0
1.79k stars 105 forks source link

[bug] import --as unclear behavior #368

Closed tomasz13nocon closed 1 year ago

tomasz13nocon commented 1 year ago

Dotdrop version: v1.11

Describe the bug

It's not clear from the documentation how --as is supposed to interpret its argument. dotdrop import -d ~/.config/nvim --as test results in: [DRY] would copy /home/user/.config/nvim to /home/user/my_dotfiles/my_dotpath/my_dotfiles/test and using the example from the documentation: dotdrop import -d ~/.config/nvim --as ~/test [DRY] would copy /home/user/.config/nvim to /home/user/my_dotfiles/my_dotpath/test

The tilde seems to mean the dotpath instead of home directory, which is confusing. And using --as without the tilde just acts weird, creating another dotfiles directory inside dotpath.

I had a look at the import-as.sh bash test, and it only tests usage with the tilde.

Steps to Reproduce

  1. mkdir ~/my_dotfiles
  2. set dotpath to my_dotpath
  3. run the commands above

Expected behavior

It would be good to mention in the documentation that --as is supposed to be used with tilde (as without it, the behavior is unexpected), and that the tilde means dotpath, not home.

Alternatively to make it more intuitive, don't use the tilde and interpret the argument as a path relative to the dotpath, so that --as some/path would result my_dotfiles/my_dotpath/some/path

deadc0de6 commented 1 year ago

Dotdrop will do the following to the argument of --as on import:

This means that:

What --as provides is a way to import a dotfile but pretend it is a different file. Here is the initial issue for this feature: https://github.com/deadc0de6/dotdrop/issues/220.

I will complete the doc and better detail its usage and how its argument is handled, thanks for pointing that out.

deadc0de6 commented 1 year ago

Doc is updated: https://dotdrop.readthedocs.io/en/latest/usage/#import-dotfiles. Hopefully it is clearer now.