diff --git a/.local/bin/scripts/git-get b/.local/bin/scripts/git-get index 70079c1..a43f96a 100755 --- a/.local/bin/scripts/git-get +++ b/.local/bin/scripts/git-get @@ -4,5 +4,5 @@ set -e remote=$(git-repo "$@") echo "Cloning $remote" git clone $remote ${@:4} --recurse-submodules -cd "$(expr "$2" || basename ${remote%.git})" +cd "$(test -n "$2" && echo "$2" || basename ${remote%.git})" exec "$SHELL" diff --git a/.local/bin/scripts/git-repo b/.local/bin/scripts/git-repo index 2416479..1b7b26e 100755 --- a/.local/bin/scripts/git-repo +++ b/.local/bin/scripts/git-repo @@ -1,7 +1,10 @@ #!/bin/sh -# Translates different repo notations into ssh +# Translate different repo notations into ssh +# Usage: +# git repo +# git repo [user] case "$1" in - (http*) echo $1 | sed "s|.*//\([^/]*\)/\(.*\)|git@\1:\2.git|";; + (http*) echo "$1" | sed "s|.*//\([^/]*\)/\(.*\)|git@\1:\2.git|" ;; (git:*) echo "$1" ;; (*) echo "${1:-git.jfischer.org}:${3:-$(git config user.name)}/${2:-$(basename $PWD)}.git" ;; esac