summaryrefslogtreecommitdiff
path: root/clone
diff options
context:
space:
mode:
authorDavid Wührer <def@gmx.at>2023-05-13 17:15:33 +0200
committerDavid Wührer <def@gmx.at>2023-05-13 17:15:33 +0200
commit9bd7b1078f0d23bd452110451d1762f118e99fbf (patch)
tree91791ba13253d28039564cd555a37d0628fd4ea6 /clone
parentdc3b063ef6b370d1b3594ed785c682ea2db09b41 (diff)
improvements
Diffstat (limited to 'clone')
-rwxr-xr-xclone24
1 files changed, 18 insertions, 6 deletions
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