aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorEgor Tensin <egor@tensin.name>2026-10-11 21:17:13 +0500
committerEgor Tensin <egor@tensin.name>2026-10-12 12:00:40 +0500
commitabb8d2f37777f8bbabfcc87ead6f6e3f70aef4ad (patch)
treeada8762c279cedd2a1383c32688883382785f078
parentgit.sh: readonly -> local (diff)
downloadlinux-home-abb8d2f37777f8bbabfcc87ead6f6e3f70aef4ad.tar.gz
linux-home-abb8d2f37777f8bbabfcc87ead6f6e3f70aef4ad.zip
git.sh: add shortcut to clone my repos
-rw-r--r--%HOME%/.bash_utils/git.sh29
1 files changed, 29 insertions, 0 deletions
diff --git a/%HOME%/.bash_utils/git.sh b/%HOME%/.bash_utils/git.sh
index 9e28e86..fcc84bb 100644
--- a/%HOME%/.bash_utils/git.sh
+++ b/%HOME%/.bash_utils/git.sh
@@ -113,3 +113,32 @@ git_replace_word() (
file_replace_word "$str" "$sub" ${paths[@]+"${paths[@]}"}
)
+
+clone() (
+ _bash_func_prelude
+
+ if [ "$#" -lt 1 ] || [ "$#" -gt 2 ]; then
+ echo "usage: ${FUNCNAME[0]} NAME [bb]" >&2
+ exit 1
+ fi
+
+ local username=egor-tensin
+ local host=
+ [ "$#" -gt 1 ] && host="$2"
+ local name="$1"
+
+ case "$host" in
+ '')
+ host='github.com'
+ ;;
+ bb)
+ host='bitbucket.org'
+ ;;
+ *)
+ echo "${FUNCNAME[0]}: invalid host: $host" >&2
+ return 1
+ ;;
+ esac
+
+ git clone --recursive "ssh://git@$host/egor-tensin/$name.git"
+)