diff options
| author | Egor Tensin <egor@tensin.name> | 2026-10-11 21:17:13 +0500 |
|---|---|---|
| committer | Egor Tensin <egor@tensin.name> | 2026-10-12 12:00:40 +0500 |
| commit | abb8d2f37777f8bbabfcc87ead6f6e3f70aef4ad (patch) | |
| tree | ada8762c279cedd2a1383c32688883382785f078 /%HOME% | |
| parent | git.sh: readonly -> local (diff) | |
| download | linux-home-abb8d2f37777f8bbabfcc87ead6f6e3f70aef4ad.tar.gz linux-home-abb8d2f37777f8bbabfcc87ead6f6e3f70aef4ad.zip | |
git.sh: add shortcut to clone my repos
Diffstat (limited to '%HOME%')
| -rw-r--r-- | %HOME%/.bash_utils/git.sh | 29 |
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" +) |
