summaryrefslogtreecommitdiff
path: root/clone
diff options
context:
space:
mode:
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