diff options
author | David Wührer <def@gmx.at> | 2023-05-13 17:15:33 +0200 |
---|---|---|
committer | David Wührer <def@gmx.at> | 2023-05-13 17:15:33 +0200 |
commit | 9bd7b1078f0d23bd452110451d1762f118e99fbf (patch) | |
tree | 91791ba13253d28039564cd555a37d0628fd4ea6 /clone | |
parent | dc3b063ef6b370d1b3594ed785c682ea2db09b41 (diff) |
improvements
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 |