-elif [ "$1" = 'init' ]; then
- verbose "init begin"
- export REPO_NAME="$2"
- export GIT_DIR="$VCSH_BASE/$REPO_NAME.git"
- init
- vcsh use $REPO_NAME
- verbose "init end"
-
-elif [ "$1" = 'exit' ]; then
- verbose "exit begin"
- if [ -n "$ZSH_VERSION" ] && [ "$VCSH_NO_IGNORE_EOF" = '1' ]; then
- unset VCSH_NO_IGNORE_EOF
- setopt NO_IGNORE_EOF
+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