From 96c80ffe802dc7c93a21f3c815540393ba0d0b86 Mon Sep 17 00:00:00 2001 From: Bjorn Neergaard Date: Tue, 20 Nov 2018 20:01:48 -0700 Subject: [PATCH] Remove openopt, allow spaces in $BROWSER Remove the openopt variable, instead opting to allow spaces in `$BROWSER`. `$BROWSER` as used by the XDG implementation allows spaces (and `%s` printf-style formatting strings), and is actually a PATH-style list. While this patch doesn't make git-open compliant with the XDG-style variable, it does allow for the use of `BROWSER="powershell.exe Start"` in the environment. --- git-open | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/git-open b/git-open index d93a63d..6a38c7a 100755 --- a/git-open +++ b/git-open @@ -235,21 +235,16 @@ case $( uname -s ) in CYGWIN*) open='cygstart';; *) # Try to detect WSL (Windows Subsystem for Linux) if uname -r | grep -q Microsoft; then - open='powershell.exe' - openopt='Start' + open='powershell.exe Start' else open='xdg-open' fi;; esac # Allow printing the url if BROWSER=echo -if [[ $BROWSER == "echo" ]]; then - openopt='' -else +if [[ $BROWSER != "echo" ]]; then exec &>/dev/null fi # open it in a browser -${BROWSER:-$open} $openopt "$openurl" - -unset openopt +${BROWSER:-$open} "$openurl"