MCPcopy
hub / github.com/dgraph-io/dgraph / Commands

Function Commands

contrib/jepsen/browser/browser.go:18–41  ·  view source on GitHub ↗

Commands returns a list of possible commands to use to open a url.

()

Source from the content-addressed store, hash-verified

16
17// Commands returns a list of possible commands to use to open a url.
18func Commands() [][]string {
19 var cmds [][]string
20 if exe := os.Getenv("BROWSER"); exe != "" {
21 cmds = append(cmds, []string{exe})
22 }
23 switch runtime.GOOS {
24 case "darwin":
25 cmds = append(cmds, []string{"/usr/bin/open"})
26 case "windows":
27 cmds = append(cmds, []string{"cmd", "/c", "start"})
28 default:
29 if os.Getenv("DISPLAY") != "" {
30 // xdg-open is only for use in a desktop environment.
31 cmds = append(cmds, []string{"xdg-open"})
32 }
33 }
34 cmds = append(cmds,
35 []string{"chrome"},
36 []string{"google-chrome"},
37 []string{"chromium"},
38 []string{"firefox"},
39 )
40 return cmds
41}
42
43// Open tries to open url in a browser and reports whether it succeeded.
44func Open(url string) bool {

Callers 1

OpenFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected