#!/bin/sh

CONFIG="$HOME/config"

NUMFILES=$#
while [ $# -gt 0 ]; do
    FILE="$1"
    shift
    NEWFILE="${FILE#.}"
    echo " * Configurizing $NEWFILE ..."
    mv "$FILE" "$CONFIG/$NEWFILE"
    ln -s "$CONFIG/$NEWFILE" "$FILE"
    pushd "$CONFIG"
    git add "$NEWFILE"
    git commit -m "[NEW] Configurized '$NEWFILE'"
    popd
done

echo " * $NUMFILES new files/directories"

echo " * Pushing configs to remote repository ... "
pushd "$CONFIG"
git push origin master
popd

echo " * Done"
