diff options
Diffstat (limited to 'clone')
-rwxr-xr-x | clone | 24 |
1 files changed, 18 insertions, 6 deletions
@@ -2,11 +2,23 @@ set -eu -for arg in "$@" +args=() +for url in "$@" do - dir=${arg#*:} - dir="$HOME"/src/${dir%/*} - mkdir -pv "$dir" - cd "$dir" - git clone --verbose --progress "$arg" + case $url in + https://*|git://*) + dir=${url#*//} + dir=${dir%/*} + ;; git@*) + dir=${url#git@} + dir=${dir/://} + dir=${dir%/*} + ;; *) + args+=("$url") + continue + esac + mkdir -vp ~/src/"$dir" + cd ~/src/"$dir" + git clone --verbose --progress "${args[@]}" "$url" + args=() done |