dotfiles/.local/bin/scripts/gor
2025-03-15 13:52:06 +03:00

13 lines
309 B
Bash
Executable file

#!/bin/bash
url="$(git remote get-url "${1:-origin}")"
if [[ "$url" =~ ^https?:\/\/ ]]; then
xdg-open "$url"
elif [[ "$url" =~ ^[a-zA-Z0-9_-]+@([a-zA-Z0-9_.-]+):(.*) ]]; then
url="https://${BASH_REMATCH[1]}/${BASH_REMATCH[2]}"
url="${url%.git}"
xdg-open "$url"
else
echo "TODO: $url"
fi