#!/bin/sh

DOTFILES_DIR="${HOME}/Software/dotfiles"

declare -a FILES=(
    .bash_profile
    .bashrc
    .inputrc
    .iterm2_shell_integration.bash
    .xinitrc
    .config/nvim/init.vim
    .config/nvim/coc-settings.json
    .config/nvim/telescope.lua
    .config/lf/
    .dwm/autostart.sh
    .dwm/dwm-sss
    .local/bin/
    .zsh/
    .zshrc
)

for F in ${FILES[@]}; do
    FILE="${HOME}/$F"
    if [[ ! -f $FILE && ! -d $FILE ]]; then
        continue
    fi

    if [[ -d $FILE ]]; then
        cp -r "${FILE}" "${DOTFILES_DIR}/$(dirname ${F})"
        continue
    fi

    cp -r "${FILE}" "${DOTFILES_DIR}/${F}"
done

cd $HOME/Software/dotfiles/

git add .
git commit -m "$(date)"
git push origin $(git rev-parse --abbrev-ref HEAD)
