|
87 | 87 | (filter some?))
|
88 | 88 | [(str "--app=" url)]))
|
89 | 89 |
|
| 90 | +(defn- get-browser [] |
| 91 | + #?(:clj (System/getenv "BROWSER") |
| 92 | + :cljs (.-BROWSER js/process.env) |
| 93 | + :cljr (Environment/GetEnvironmentVariable "BROWSER"))) |
| 94 | + |
90 | 95 | (defn- browse [url]
|
91 |
| - #?(:clj |
92 |
| - (try (browse-url url) |
93 |
| - (catch Exception _e |
94 |
| - (println "Goto" url "to view portal ui."))) |
95 |
| - :cljs |
96 |
| - (case (.-platform js/process) |
97 |
| - ("android" "linux") (shell/sh "xdg-open" url) |
98 |
| - "darwin" (shell/sh "open" url) |
99 |
| - "win32" (shell/sh "cmd" "/c" "start" url) |
100 |
| - (println "Goto" url "to view portal ui.")) |
101 |
| - :cljr |
102 |
| - (condp identical? (.Platform Environment/OSVersion) |
103 |
| - PlatformID/Win32NT (shell/sh "cmd" "/c" "start" url) |
104 |
| - PlatformID/Win32Windows (shell/sh "cmd" "/c" "start" url) |
105 |
| - PlatformID/Unix (if (RuntimeInformation/IsOSPlatform OSPlatform/OSX) |
106 |
| - (shell/sh "open" url) |
107 |
| - (shell/sh "xdg-open" url)) |
108 |
| - (println "Goto" url "to view portal ui.")))) |
| 96 | + (or |
| 97 | + (some-> (get-browser) (shell/sh url)) |
| 98 | + #?(:clj |
| 99 | + (try (browse-url url) |
| 100 | + (catch Exception _e |
| 101 | + (println "Goto" url "to view portal ui."))) |
| 102 | + :cljs |
| 103 | + (case (.-platform js/process) |
| 104 | + ("android" "linux") (shell/sh "xdg-open" url) |
| 105 | + "darwin" (shell/sh "open" url) |
| 106 | + "win32" (shell/sh "cmd" "/c" "start" url) |
| 107 | + (println "Goto" url "to view portal ui.")) |
| 108 | + :cljr |
| 109 | + (condp identical? (.Platform Environment/OSVersion) |
| 110 | + PlatformID/Win32NT (shell/sh "cmd" "/c" "start" url) |
| 111 | + PlatformID/Win32Windows (shell/sh "cmd" "/c" "start" url) |
| 112 | + PlatformID/Unix (if (RuntimeInformation/IsOSPlatform OSPlatform/OSX) |
| 113 | + (shell/sh "open" url) |
| 114 | + (shell/sh "xdg-open" url)) |
| 115 | + (println "Goto" url "to view portal ui."))))) |
109 | 116 |
|
110 | 117 | #?(:clj (defn- random-uuid [] (java.util.UUID/randomUUID)))
|
111 | 118 |
|
|
0 commit comments