38 lines
656 B
Text
38 lines
656 B
Text
function _decide_git_proto {
|
|
local ssh="ssh://git@"
|
|
local https="https://"
|
|
|
|
local proto="${(P)${1:-ssh}:?unknown git protocol}"
|
|
|
|
echo "$proto"
|
|
}
|
|
|
|
_git_proto=$(_decide_git_proto "$GIT_PROTO")
|
|
|
|
function pull {
|
|
git -C $mod/$1 pull 2>&1 \
|
|
| grep -v 'up to date.'
|
|
}
|
|
|
|
function clone {
|
|
local name="$1"
|
|
local remote="$_git_proto$2"
|
|
local dir="$mod/$name"
|
|
|
|
if [[ ! -d $dir ]]; then
|
|
echo "=== getting $name (mod/$name):"
|
|
git clone $remote.git $dir 2>&1
|
|
fi
|
|
}
|
|
|
|
function clone-gh {
|
|
clone "$1" "github.com/$2"
|
|
}
|
|
|
|
function clone-cq {
|
|
clone "$1" "ravy.dev/coquette/$1"
|
|
}
|
|
|
|
function clone-bird {
|
|
clone "$1" "codeberg.org/birdsong/$1"
|
|
}
|