holman / dotfiles

@holman does dotfiles

Home Page:http://zachholman.com/2010/08/dotfiles-are-meant-to-be-forked/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

depth > 2 *.symlink

k-f- opened this issue · comments

Heya, I would make a pull request but I don't really know how to do that.

Sometimes I want to have a couple symlinks setup a dir deeper than normal in the repo.
example:

~/.dotfiles/email/
~/.dotfiles/email/mutt.symlink
~/.dotfiles/email/offlineimap/offlineimap.rsync

The last one there wouldn't be linked by scripts/bootstrap.sh because of -depth 2 in teh find command.

Anyhow, here is my change that will thankfully ignore the $PWD/.git/modules/ folders that may or may not have *.symlink folder names.

install_dotfiles () {
  info 'installing dotfiles'

  local overwrite_all=false backup_all=false skip_all=false

  for src in $(find "$DOTFILES_ROOT" -maxdepth 3 -name '*.symlink')
  do
    if [[ $src != *".git/"* ]]
    then
        dst="$HOME/.$(basename "${src%.*}")"
        link_file "$src" "$dst"
    fi
  done
}

it's not bulletproof, but it doesn't seem likely to exclude anything I wouldn't need it to.

cheers!

Cool! Glad you found something to work for ya.

I'm a little torn on including this; there's been a few other more sort of alternative setups when it comes to exactly what we symlink into the main directory, and I'm just a tad bit wary of doing these one-offs (what if you have three nested directories? Do we support unlimited? Is .git the only thing we should exclude, or should that be a more customizable array?)

I think for now I'm going to hold off on including it in the repo right now, although I think at some point we might want to step back and think about what makes the most sense to support in a general standpoint for the project. In the meantime, thanks for dropping the code in here; we can point to this if someone else runs into this in the future. :)