+VCSH_COMMAND=$1; export VCSH_COMMAND
+
+case $VCSH_COMMAND in
+ clon|clo|cl) VCSH_COMMAND=clone;;
+ commi|comm|com|co) VCSH_COMMAND=commit;;
+ delet|dele|del|de) VCSH_COMMAND=delete;;
+ ente|ent|en) VCSH_COMMAND=enter;;
+ hel|he) VCSH_COMMAND=help;;
+ ini|in) VCSH_COMMAND=init;;
+ pul) VCSH_COMMAND=pull;;
+ pus) VCSH_COMMAND=push;;
+ renam|rena|ren|re) VCSH_COMMAND=rename;;
+ ru) VCSH_COMMAND=run;;
+ statu|stat|sta|st) VCSH_COMMAND=status;;
+ upgrad|upgra|upgr|up) VCSH_COMMAND=upgrade;;
+ versio|versi|vers|ver|ve) VCSH_COMMAND=version;;
+ which|whi|wh) VCSH_COMMAND=which;;
+ write|writ|wri|wr) VCSH_COMMAND=write-gitignore;;
+esac
+
+if [ x"$VCSH_COMMAND" = x'clone' ]; then
+ [ -z "$2" ] && fatal "$VCSH_COMMAND: please specify a remote" 1
+ GIT_REMOTE="$2"
+ [ -n "$3" ] && VCSH_REPO_NAME=$3 || VCSH_REPO_NAME=$(basename "${GIT_REMOTE#*:}" .git)
+ [ -z "$VCSH_REPO_NAME" ] && fatal "$VCSH_COMMAND: could not determine repository name" 1
+ export VCSH_REPO_NAME
+ GIT_DIR=$VCSH_REPO_D/$VCSH_REPO_NAME.git; export GIT_DIR
+elif [ "$VCSH_COMMAND" = 'version' ]; then
+ echo "$SELF $VERSION"
+ git version
+ exit
+elif [ x"$VCSH_COMMAND" = x'which' ]; then
+ [ -z "$2" ] && fatal "$VCSH_COMMAND: please specify a filename" 1
+ [ -n "$3" ] && fatal "$VCSH_COMMAND: too many parameters" 1
+ VCSH_COMMAND_PARAMETER=$2; export VCSH_COMMAND_PARAMETER
+elif [ x"$VCSH_COMMAND" = x'delete' ] ||
+ [ x"$VCSH_COMMAND" = x'enter' ] ||
+ [ x"$VCSH_COMMAND" = x'init' ] ||
+ [ x"$VCSH_COMMAND" = x'list-tracked-by' ] ||
+ [ x"$VCSH_COMMAND" = x'rename' ] ||
+ [ x"$VCSH_COMMAND" = x'run' ] ||
+ [ x"$VCSH_COMMAND" = x'upgrade' ] ||
+ [ x"$VCSH_COMMAND" = x'write-gitignore' ]; then
+ [ -z "$2" ] && fatal "$VCSH_COMMAND: please specify repository to work on" 1
+ [ x"$VCSH_COMMAND" = x'rename' ] && [ -z "$3" ] && fatal "$VCSH_COMMAND: please specify a target name" 1
+ [ x"$VCSH_COMMAND" = x'run' ] && [ -z "$3" ] && fatal "$VCSH_COMMAND: please specify a command" 1
+ VCSH_REPO_NAME=$2; export VCSH_REPO_NAME
+ GIT_DIR=$VCSH_REPO_D/$VCSH_REPO_NAME.git; export GIT_DIR
+ [ x"$VCSH_COMMAND" = x'rename' ] && { VCSH_REPO_NAME_NEW=$3; export VCSH_REPO_NAME_NEW;
+ GIT_DIR_NEW=$VCSH_REPO_D/$VCSH_REPO_NAME_NEW.git; export GIT_DIR_NEW; }
+ [ x"$VCSH_COMMAND" = x'run' ] && shift 2
+elif [ x"$VCSH_COMMAND" = x'commit' ] ||
+ [ x"$VCSH_COMMAND" = x'list' ] ||
+ [ x"$VCSH_COMMAND" = x'list-tracked' ] ||
+ [ x"$VCSH_COMMAND" = x'list-untracked' ] ||
+ [ x"$VCSH_COMMAND" = x'pull' ] ||
+ [ x"$VCSH_COMMAND" = x'push' ]; then
+ :
+elif [ x"$VCSH_COMMAND" = x'status' ]; then
+ VCSH_REPO_NAME=$2; export VCSH_REPO_NAME
+elif [ -n "$2" ]; then
+ VCSH_COMMAND='run'; export VCSH_COMMAND
+ VCSH_REPO_NAME=$1; export VCSH_REPO_NAME
+ GIT_DIR=$VCSH_REPO_D/$VCSH_REPO_NAME.git; export GIT_DIR
+ [ -d "$GIT_DIR" ] || { help; exit 1; }
+ shift 1
+ set -- "git" "$@"
+elif [ -n "$VCSH_COMMAND" ]; then
+ VCSH_COMMAND='enter'; export VCSH_COMMAND
+ VCSH_REPO_NAME=$1; export VCSH_REPO_NAME
+ GIT_DIR=$VCSH_REPO_D/$VCSH_REPO_NAME.git; export GIT_DIR
+ [ -d "$GIT_DIR" ] || { help; exit 1; }