#!/bin/bash
###############################################################
# NAME
#   configure   -- configure local machine with .rc files
#               or collect all local configure files to .rc
#
# USAGE
#   ./configure     -- configure local machine
#   ./configure -c  -- collect local configure files 
#
# NOTE
#    check $PATH include
#         /usr/local/sbin
#         /usr/local/bin
#         /usr/sbin
#         /usr/bin
#         /sbin
#         /bin
#  
#  AUTHOR
#     Aborn Jiang (aborn.jiang@gmail.com)
#  
#  VERSION
#    v0.1    2014-03-04
###############################################################
ABSPATH=$(dirname $0)
cd ${ABSPATH}
echo "ABSPATH=${ABSPATH}"

function conf-local()
{
    cp ${ABSPATH}/.rc/.zshrc ~
    cp ${ABSPATH}/.rc/.bashrc ~
    cp ${ABSPATH}/.rc/.bash_aliases ~
    cp ${ABSPATH}/.rc/.vimrc ~
}

function collect()
{
    cp ~/.zshrc ${ABSPATH}/.rc/
    cp ~/.bashrc ${ABSPATH}/.rc/
    cp ~/.bash_aliases ${ABSPATH}/.rc/
    cp ~/.vimrc ${ABSPATH}/.rc/
}

function __main__()
{
    if [ "$1X" == "-cX" ];then
        echo "-c argument, collect configure files."
        collect
    elif [ "$1X" == "X" ];then
        conf-local
        echo "configure local with .rc succuess."
    else
        echo "error argument."
        exit -1
    fi
}

__main__ $1