#!/bin/bash
gitignore="/Users/derek/Workspaces/gitignore"
function Create
{
echo "start create"
if [ -f ".gitignore" ]
then
rm .gitignore
fi
for arg in "$@"
do
file=$gitignore/$arg.gitignore
file1=$gitignore/Global/$arg.gitignore
if [ -f "$file" ]
then
cat $file >> ./.gitignore
else if [ -f "$file1" ]
then
cat $file1 >> ./.gitignore
else
echo "Can't find $arg.gitignore"
fi
fi
done
echo "Create Completed!"
}
function List
{
ls $gitignore/ | sed -e 's/\..*$//'
ls $gitignore/Global/ | sed -e 's/\..*$//'
}
if [ "$1" == "create" ]
then
shift 1
Create $@
elif [ "$1" == "list" ]
then
List
else
echo "not support sub-command: $1"
fi