technicalpickles/homesick

Pretend mode does not work for link/unlink

nwinkler opened this issue · 2 comments

Homesick version: 1.1.5

The pretend option always seems to use the current directory instead of the castle, which means that it's showing the wrong results unless you run it from the castle's home directory.

Example:

Run from the castle's home directory - this is the expected result, and this is what it should look like regardless of where you run it from:

$ pwd
~/.homesick/repos/dotfiles/home 
$ homesick link -p dotfiles
   identical  /Users/nils.winkler/.ackrc
   identical  /Users/nils.winkler/.atom
   identical  /Users/nils.winkler/.bash_home
   identical  /Users/nils.winkler/.bash_profile
   identical  /Users/nils.winkler/.bash_work
   identical  /Users/nils.winkler/.dirs
   identical  /Users/nils.winkler/.fzf.bash
   identical  /Users/nils.winkler/.gemrc
   identical  /Users/nils.winkler/.gitconfig
   identical  /Users/nils.winkler/.hyperterm.js
   identical  /Users/nils.winkler/.screenrc
   identical  /Users/nils.winkler/.todo
   identical  /Users/nils.winkler/.todo.actions.d
   identical  /Users/nils.winkler/.vim
   identical  /Users/nils.winkler/.vimrc

Run from the castle's main directory:

$ pwd
~/.homesick/repos/dotfiles
$ homesick link -p dotfiles
     symlink  /Users/nils.winkler/.homesick/repos/dotfiles/.git to /Users/nils.winkler/.git
     symlink  /Users/nils.winkler/.homesick/repos/dotfiles/.gitignore to /Users/nils.winkler/.gitignore
     symlink  /Users/nils.winkler/.homesick/repos/dotfiles/.gitmodules to /Users/nils.winkler/.gitmodules
     symlink  /Users/nils.winkler/.homesick/repos/dotfiles/.homesickrc to /Users/nils.winkler/.homesickrc
     symlink  /Users/nils.winkler/.homesick/repos/dotfiles/Dark.terminal to /Users/nils.winkler/Dark.terminal
     symlink  /Users/nils.winkler/.homesick/repos/dotfiles/home to /Users/nils.winkler/home
     symlink  /Users/nils.winkler/.homesick/repos/dotfiles/install_bash_it.sh to /Users/nils.winkler/install_bash_it.sh
     symlink  /Users/nils.winkler/.homesick/repos/dotfiles/install_dev.sh to /Users/nils.winkler/install_dev.sh
     symlink  /Users/nils.winkler/.homesick/repos/dotfiles/install_general.sh to /Users/nils.winkler/install_general.sh
     symlink  /Users/nils.winkler/.homesick/repos/dotfiles/install_homebrew.sh to /Users/nils.winkler/install_homebrew.sh
     symlink  /Users/nils.winkler/.homesick/repos/dotfiles/LICENSE to /Users/nils.winkler/LICENSE
     symlink  /Users/nils.winkler/.homesick/repos/dotfiles/osx-settings.sh to /Users/nils.winkler/osx-settings.sh
     symlink  /Users/nils.winkler/.homesick/repos/dotfiles/README.md to /Users/nils.winkler/README.md

As you can see, the link -p command is trying to evaluate the files of the current directory instead of using the files from the specified castle's home directory. If I run this command from a different directory, it will use that directory's files.

Am I using this wrong, or is this a bug? The same happens for the unlink -p command.

Both work fine if run without the -p flag.

This definitely looks like a bug to me. Are you able to look at this and offer a PR? If not I can try to look into it sometime soon.

Not sure when I can find the time to do that...

And I've never used Ruby before - that hasn't stopped me in the past, though. I'm sure I can figure it out, if I can find the time.