openBrowser opens a URL in the default browser
(url string)
| 171 | |
| 172 | // openBrowser opens a URL in the default browser |
| 173 | func openBrowser(url string) error { |
| 174 | var cmd *exec.Cmd |
| 175 | |
| 176 | switch runtime.GOOS { |
| 177 | case "darwin": |
| 178 | cmd = exec.Command("open", url) |
| 179 | case "linux": |
| 180 | cmd = exec.Command("xdg-open", url) |
| 181 | case "windows": |
| 182 | cmd = exec.Command("rundll32", "url.dll,FileProtocolHandler", url) |
| 183 | default: |
| 184 | return fmt.Errorf("unsupported platform") |
| 185 | } |
| 186 | |
| 187 | return cmd.Start() |
| 188 | } |
| 189 | |
| 190 | // copyToClipboard copies text to the system clipboard |
| 191 | func copyToClipboard(text string) error { |
no outgoing calls
no test coverage detected