#!/bin/sh
#
# Install my dotfiles.
#

STOW=$(which stow || echo -n "")
if [ -z "$STOW" ]; then
  STOW="./stow.sh -s"
fi

git submodule update --init --recursive

# if these aren't links, move them out of the way?
for f in ~/.zshrc ~/.profile; do
  if [ -f "$f" ]; then
    mv "$f" "$f.orig"
  fi
done

if [ -n "$1" ]; then
  $STOW -t $HOME "$1"
  exit 1
fi

# rm -f $HOME/.zshrc $HOME/.profile >/dev/null 2>&1

# install all dotfiles
#find * -maxdepth 0 -type d | xargs -I{} $STOW -t "$HOME" {}

# install general dotfiles
for dir in  \
  git \
  vim \
  sh \
  ssh \
  tmux \
  zsh \
  aichat \
  npm \
  direnv
do
  $STOW -t $HOME $dir
done

