(ctx context.Context, url string)
| 37 | } |
| 38 | |
| 39 | func openBrowser(ctx context.Context, url string) error { |
| 40 | var cmd *exec.Cmd |
| 41 | switch runtime.GOOS { |
| 42 | case "darwin": |
| 43 | cmd = exec.CommandContext(ctx, "open", url) |
| 44 | case "windows": |
| 45 | cmd = exec.CommandContext(ctx, "cmd", "/c", "start", url) |
| 46 | default: |
| 47 | cmd = exec.CommandContext(ctx, "xdg-open", url) |
| 48 | } |
| 49 | return cmd.Start() |
| 50 | } |