+if [ "$1" = 'clone' ]; then
+ [ -z $2 ] && fatal "$1: please specify a remote" 1
+ export VCSH_COMMAND="$1"
+ GIT_REMOTE="$2"
+ [ -n "$3" ] && VCSH_REPO_NAME="$3" || VCSH_REPO_NAME=$(basename "$GIT_REMOTE" .git)
+ export VCSH_REPO_NAME
+ export GIT_DIR="$VCSH_BASE/$VCSH_REPO_NAME.git"
+elif [ "$1" = 'delete' ] ||
+ [ "$1" = 'enter' ] ||
+ [ "$1" = 'init' ] ||
+ [ "$1" = 'list-tracked-all' ] ||
+ [ "$1" = 'rename' ] ||
+ [ "$1" = 'run' ] ||
+ [ "$1" = 'seed-gitignore' ] ||
+ [ "$1" = 'setup' ]; then
+ [ -z $2 ] && fatal "$1: please specify repository to work on" 1
+ [ "$1" = 'rename' -a -z "$3" ] && fatal "$1: please specify a target name" 1
+ [ "$1" = 'run' -a -z "$3" ] && fatal "$1: please specify a command" 1
+ export VCSH_COMMAND="$1"
+ export VCSH_REPO_NAME="$2"
+ export GIT_DIR="$VCSH_BASE/$VCSH_REPO_NAME.git"
+ [ "$VCSH_COMMAND" = 'rename' ] && export GIT_DIR_NEW="$VCSH_BASE/$3.git"
+ if [ "$VCSH_COMMAND" = 'run' ]; then
+ shift 2
+ export VCSH_EXTERNAL_COMMAND="$*"
+ # Did we receive a directory instead of a name? Mangle the input to fit normal operation!
+ if echo $VCSH_REPO_NAME | grep -q '/'; then
+ export GIT_DIR=$VCSH_REPO_NAME
+ export VCSH_REPO_NAME=$(basename $VCSH_REPO_NAME .git)
+ fi
+ fi
+ [ "$VCSH_COMMAND" = 'seed-gitignore' ]
+# [ "$VCSH_COMMAND" = 'seed-gitignore' ] && export VCSH_COMMAND='seed_gitignore'
+elif [ "$1" = 'list' ]; then
+ export VCSH_COMMAND="$1"
+elif [ -n "$1" ]; then
+ export VCSH_COMMAND=run
+ export VCSH_REPO_NAME="$1"
+ export GIT_DIR="$VCSH_BASE/$VCSH_REPO_NAME.git"
+ [ -d $GIT_DIR ] || { help; exit 1; }
+ shift 1
+ export VCSH_EXTERNAL_COMMAND="git $*"