-
-if [ "$1" = 'clone' ]; then
- export VCSH_COMMAND="$1"
- GIT_REMOTE="$2"
- export GIT_REMOTE
- VCSH_REPO_NAME="$3"
- [ -z "$VCSH_REPO_NAME" ] && 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" = 'run' ] ||
- [ "$1" = 'seed-gitignore' ] ||
- [ "$1" = 'use' ]; then
- [ -z $2 ] && echo "$SELF $1: error: please specify repository to work on" && return 1
- export VCSH_COMMAND="$1"
- export VCSH_REPO_NAME="$2"
- export GIT_DIR="$VCSH_BASE/$VCSH_REPO_NAME.git"
- shift 2
- export VCSH_EXTERNAL_COMMAND="$*"
- if [ "$VCSH_COMMAND" = 'run' ]; then
- [ -z "$VCSH_EXTERNAL_COMMAND" ] && echo "$SELF $1 $2: error: please specify a command" && return 1
- fi
-elif [ "$1" = 'exit' ] ||
- [ "$1" = 'help' ] ||
- [ "$1" = 'list' ]; then
- export VCSH_COMMAND="$1"
-else
- [ -z $1 ] && help && return 0
- export VCSH_COMMAND='run'
- export VCSH_REPO_NAME="$1"
- export GIT_DIR="$VCSH_BASE/$VCSH_REPO_NAME.git"
- [ -d $GIT_DIR ] || (help && return 1) || return 0
- shift 1
- export VCSH_EXTERNAL_COMMAND="git $*"
-fi
-
-
-for check_directory in "$VCSH_BASE" "$HOME/.gitignore.d"
-do
- if [ ! -d "$check_directory" ]; then
- if [ -e "$check_directory" ]; then
- echo "$SELF: error: $check_directory exists but is not a directory" >&2
- return 2
- else
- echo "$SELF: info: attempting to create $check_directory"
- mkdir -p "$check_directory" || (echo "$SELF: error: could not create $check_directory" >&2; return 2) || return $?
- fi
- fi
-done
-
-
-if [ "$VCSH_COMMAND" = 'clone' ]; then
- verbose "clone begin"