Skip to content

Commit

Permalink
Merge pull request #4 from Djuuu/open-host-browser-on-wsl
Browse files Browse the repository at this point in the history
Open windows host browser when running under WSL
  • Loading branch information
Djuuu authored Apr 24, 2023
2 parents 6686f07 + 1a91d54 commit 129d0f1
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions git-mr
Original file line number Diff line number Diff line change
Expand Up @@ -380,9 +380,11 @@ open_in_browser() {
[[ -n $url ]] || return "$ERR_MR"

local open_command
if [[ "$OSTYPE" == "linux-gnu"* ]]; then open_command='xdg-open';
elif [[ "$OSTYPE" == "darwin"* ]]; then open_command='open';
elif [[ "$OSTYPE" == "msys"* ]]; then open_command='explorer';
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
if grep -qi microsoft /proc/version; then open_command='explorer.exe'; # WSL
else open_command='xdg-open'; fi
elif [[ "$OSTYPE" == "darwin"* ]]; then open_command='open';
elif [[ "$OSTYPE" == "msys"* ]]; then open_command='explorer';
fi

if [[ -n $open_command && -x "$(command -v "$open_command")" ]]; then
Expand Down

0 comments on commit 129d0f1

Please sign in to comment.