Add support for 'md' on WSL.
David Blume

David Blume commited on 2020-07-28 16:08:49
Showing 1 changed files, with 7 additions and 0 deletions.

... ...
@@ -29,6 +29,8 @@ if [[ $(uname -s) == CYGWIN* ]]; then
29 29
     add_to_path /usr/lib/lapack
30 30
     export GIT_SSH=/cygdrive/c/cygwin64/bin/ssh
31 31
     ulimit -n 1024 # for "duplicity"
32
+elif [[ -n "${WSL_DISTRO_NAME}" ]]; then
33
+    export BROWSER=/mnt/c/Program\ Files\ \(x86\)/Google/Chrome/Application/chrome.exe
32 34
 fi
33 35
 
34 36
 # change the color of directories in the ls command
... ...
@@ -83,8 +85,13 @@ md() {
83 85
     else
84 86
         declare -r T=$(mktemp --suffix=.html)
85 87
         curl -s -X POST --data-binary @"$1" https://md.dlma.com/ > $T
88
+        if [[ -z "${WSL_DISTRO_NAME}" ]]; then
86 89
             xdg-open $T
87 90
             echo "rm \"$T\" >/dev/null 2>&1" | at now + 2 minutes
91
+        else
92
+            # Set BROWSER to your web browser's path
93
+            "$BROWSER" $(realpath --relative-to=$PWD $T)
94
+        fi
88 95
     fi
89 96
 }
90 97
 
91 98