summaryrefslogtreecommitdiff
path: root/bin/clone
diff options
context:
space:
mode:
authorDavid Wührer <def@gmx.at>2024-05-18 21:04:34 +0200
committerDavid Wührer <def@gmx.at>2024-05-18 21:04:34 +0200
commit77cfffee6177fb0421fa0fce15d6a1875bde4816 (patch)
tree251428cdd482ea50cfb019dbd3c3bafd79d2fd14 /bin/clone
parent75b23ce1ff0daab363725a2a5755ea80bbeaa68e (diff)
manuals, sum-down, radix
Diffstat (limited to 'bin/clone')
-rwxr-xr-xbin/clone24
1 files changed, 24 insertions, 0 deletions
diff --git a/bin/clone b/bin/clone
new file mode 100755
index 0000000..cfad1af
--- /dev/null
+++ b/bin/clone
@@ -0,0 +1,24 @@
+#!/bin/bash
+
+set -eu
+
+args=()
+for url in "$@"
+do
+ 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