Skip to content

Latest commit

 

History

History
56 lines (47 loc) · 1.1 KB

todo.md

File metadata and controls

56 lines (47 loc) · 1.1 KB
  • remove tracer and debug

  • add following (from https://github.com/github/hub/blob/master/utils/utils.go) func BrowserLauncher() ([]string, error) { browser := os.Getenv("BROWSER") if browser == "" { browser = searchBrowserLauncher(runtime.GOOS) } else { browser = os.ExpandEnv(browser) }

    if browser == "" { return nil, errors.New("Please set $BROWSER to a web launcher") }

    return shellquote.Split(browser) }

func searchBrowserLauncher(goos string) (browser string) { switch goos { case "darwin": browser = "open" case "windows": browser = "cmd /c start" default: candidates := []string{"xdg-open", "cygstart", "x-www-browser", "firefox", "opera", "mozilla", "netscape"} for _, b := range candidates { path, err := exec.LookPath(b) if err == nil { browser = path break } } }

return browser

}

func CommandPath(cmd string) (string, error) { if runtime.GOOS == "windows" { cmd = cmd + ".exe" }

path, err := exec.LookPath(cmd)
if err != nil {
	return "", err
}

path, err = filepath.Abs(path)
if err != nil {
	return "", err
}

return filepath.EvalSymlinks(path)

}