#!/bin/bash SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" POSITIONAL_ARGS=() MCLOUD=0 while [[ $# -gt 0 ]]; do case $1 in --mcloud) MCLOUD=1 shift # past argument ;; -*|--*) echo "Unknown option $1" exit 1 ;; *) echo "No support positional arguments" exit 1 ;; esac done export SCRIPT_DIR ignore() { DIR="${SCRIPT_DIR}/../wp-content/${1}" FILE="${DIR}/.gitignore" if [[ ! -d $DIR ]]; then mkdir $DIR fi if [[ ! -f $DIR ]]; then echo "*" > $FILE echo "!.gitignore" >> $FILE fi git add -f $FILE } ignore uploads ignore upgrade if [[ $MCLOUD -eq 1 ]]; then ignore mcloud-reports ignore mcloud-view-cache fi # Create git ignore in quick script dir QUICK_DIR_GIT_IGNORE="${SCRIPT_DIR}/.gitignore" if [[ ! -f $QUICK_DIR_GIT_IGNORE ]]; then echo "/*.sh" > $QUICK_DIR_GIT_IGNORE fi git add -f $QUICK_DIR_GIT_IGNORE