From 9bd7b1078f0d23bd452110451d1762f118e99fbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20W=C3=BChrer?= Date: Sat, 13 May 2023 17:15:33 +0200 Subject: improvements --- clone | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'clone') diff --git a/clone b/clone index bbf920f..cfad1af 100755 --- a/clone +++ b/clone @@ -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 -- cgit v1.2.3