Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve checkOS method for better handling existing browser #6

Open
Bunchhieng opened this issue Oct 2, 2018 · 4 comments
Open

Improve checkOS method for better handling existing browser #6

Bunchhieng opened this issue Oct 2, 2018 · 4 comments

Comments

@Bunchhieng
Copy link
Owner

Current code

func checkOS() string {
	chrome := ""
	if runtime.GOOS == "windows" {
		chrome = "chrome"
	} else if runtime.GOOS == "darwin" {
		chrome = "Google Chrome"
	}
	return chrome
}
@kolten
Copy link

kolten commented Oct 2, 2018

Suggestion/slightly outside of this issue: Instead of having the user specify a browser, what about executing a system command to open their default browser?

@Bunchhieng
Copy link
Owner Author

@kolten please checkout #1 and #2

@zpeters
Copy link

zpeters commented Oct 5, 2018

We might be able to simplify browser selection. Let me know what you think.

#1 if the user specifies --browser explicitly use that exact path/command
#2 if no #1, then find the users default browser. For Macos i believe you can use "open http://myurl" and it will launch with the default browser. For windows and linux there is probably something similar

This could potentially simplify your code in the future.

What do you think?

@sarlalian
Copy link

For windows I believe it is "start http://myurl" and for linux it is "xdg-open http://myurl"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants