dotfiles/.local/bin/scripts/git-repo

8 lines
294 B
Plaintext
Raw Normal View History

#!/bin/sh
# Translates different repo notations into ssh
case "$1" in
http*) echo "git@$(echo "$1" | cut -d'/' -f3):$(echo "$1" | cut -d'/' -f4)/$(echo "$1" | cut -d'/' -f5)" ;;
git:*) echo "$1" ;;
*) echo "git@${1:-github.com}:${3:-$(git config user.name)}/${2:-$(basename $PWD)}.git" ;;
esac