-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathghweb
executable file
·23 lines (19 loc) · 831 Bytes
/
ghweb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/bin/env bash
# shellcheck disable=SC2120
die() { printf %s "${@+$@$'\n'}" 1>&2 ; exit 1 ; }
# stupid little script to
if [[ "$1" ]]; then
cd "$1" || die "could not cd to $1"
fi
fetchremote="$(git remote -v 2> /dev/null | grep -F 'github.com' | head -n1 | cut -f2)" # echo "fetchremote=$fetchremote"
if [[ -z "$fetchremote" ]]; then
echo "no entries matching 'github.com' in git remote -v output:"
git remote -v |& sed 's/^/ /'
die
fi
fetchremote="${fetchremote/ (fetch)/}"
fetchremote="${fetchremote/ (push)/}" ; echo "fetchremote=$fetchremote"
fetchremote="${fetchremote/[email protected]:/https://github.com/}" ; echo "fetchremote=$fetchremote"
# origin [email protected]:fwmechanic/shell.git (push)
# start 'https://github.com/fwmechanic/shell.git'
startfile "$fetchremote"