Skip to content

Commit

Permalink
Support alternatives for the open command
Browse files Browse the repository at this point in the history
  • Loading branch information
lennartcl committed Mar 31, 2014
1 parent bbb3aa2 commit 2588728
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
14 changes: 14 additions & 0 deletions git-info
Expand Up @@ -96,6 +96,20 @@ else
fi
fi

open() {
if which -s start && ! [[ `uname -s` =~ Darwin|Linux ]]; then
start "$1"
elif which -s xdg-open && ! [[ `uname -s` =~ Darwin ]]; then
xdg-open "$1"
elif which -s gnome-open && ! [[ `uname -s` =~ Darwin ]]; then
gnome-open "$1"
elif which -s kde-open && ! [[ `uname -s` =~ Darwin ]]; then
kde-open "$1"
else
command open "$1"
fi
}

echo "# URL:"
echo $URL

Expand Down
14 changes: 14 additions & 0 deletions git-pull-request
Expand Up @@ -67,6 +67,20 @@ if [ ! $OLD ] && ! git-is-current -q $NO_FETCH $BRANCH; then
fi
fi

open() {
if which -s start && ! [[ `uname -s` =~ Darwin|Linux ]]; then
start "$1"
elif which -s xdg-open && ! [[ `uname -s` =~ Darwin ]]; then
xdg-open "$1"
elif which -s gnome-open && ! [[ `uname -s` =~ Darwin ]]; then
gnome-open "$1"
elif which -s kde-open && ! [[ `uname -s` =~ Darwin ]]; then
kde-open "$1"
else
command open "$1"
fi
}

if echo $REMOTE | grep -q bitbucket.org; then
URL="https://$REMOTE"
if [ $OLD ]; then
Expand Down

0 comments on commit 2588728

Please sign in to comment.