mirror of
https://github.com/dcarrillo/prezto.git
synced 2025-06-14 08:41:43 +00:00
Moved hub into the git plugin.
This commit is contained in:
22
plugins/git/functions/git-hub
Normal file
22
plugins/git/functions/git-hub
Normal file
@ -0,0 +1,22 @@
|
||||
# Open the GitHub repository in the browser.
|
||||
local url=$(
|
||||
git config -l \
|
||||
| grep "remote.origin.url" \
|
||||
| sed -En "s/remote.origin.url=(git|https?)(@|:\/\/)github.com(:|\/)(.+)\/(.+).git/https:\/\/github.com\/\4\/\5/p"
|
||||
)
|
||||
|
||||
if [[ -n "$url" ]]; then
|
||||
url="${url}/tree/${$(git-branch):-master}"
|
||||
|
||||
if (( $+commands[$BROWSER] )); then
|
||||
"$BROWSER" "$url"
|
||||
return 0
|
||||
else
|
||||
print "fatal: Browser not set or set to a non-existent browser." >&2
|
||||
return 1
|
||||
fi
|
||||
else
|
||||
print "fatal: Not a Git repository or origin remote not set." >&2
|
||||
return 1
|
||||
fi
|
||||
|
Reference in New Issue
Block a user