mirror of
https://github.com/kubeshark/kubeshark.git
synced 2025-08-19 00:49:35 +00:00
* Move `cli/logger` to `shared`, and refactor all its usages in `cli` * Remove indirect for `op/go-logging` in `shared`
29 lines
521 B
Go
29 lines
521 B
Go
package uiUtils
|
|
|
|
import (
|
|
"fmt"
|
|
"os/exec"
|
|
"runtime"
|
|
|
|
"github.com/up9inc/mizu/shared/logger"
|
|
)
|
|
|
|
func OpenBrowser(url string) {
|
|
var err error
|
|
|
|
switch runtime.GOOS {
|
|
case "linux":
|
|
err = exec.Command("xdg-open", url).Start()
|
|
case "windows":
|
|
err = exec.Command("rundll32", "url.dll,FileProtocolHandler", url).Start()
|
|
case "darwin":
|
|
err = exec.Command("open", url).Start()
|
|
default:
|
|
err = fmt.Errorf("unsupported platform")
|
|
}
|
|
|
|
if err != nil {
|
|
logger.Log.Errorf("error while opening browser, %v", err)
|
|
}
|
|
}
|