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

feature: automatically launch browser on bud run #334

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

sneak
Copy link

@sneak sneak commented Nov 28, 2022

fixes #333

Copy link
Contributor

@matthewmueller matthewmueller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for opening this PR!

internal/cli/run/run.go Outdated Show resolved Hide resolved
internal/cli/run/run.go Outdated Show resolved Hide resolved
if !c.Flag.Noautolaunch { // if not not autolaunch, i.e. if autolaunch
go func() {
time.Sleep(1 * time.Second)
_ = browser.OpenURL("http://" + webln.Addr().String())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should check the error

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the only guidance here i don't understand. why? i literally can't think of anything that we'd do differently if it fails or not. it's an optional convenience feature...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My take is that if a user explicitly requested --open we should open or fail trying.

internal/cli/cli.go Outdated Show resolved Hide resolved
framework/framework.go Outdated Show resolved Hide resolved
@sneak
Copy link
Author

sneak commented Nov 29, 2022

Thanks for the review and feedback- I will update the PR soon.

sneak added a commit to sneak/bud that referenced this pull request Nov 29, 2022
Copy link
Contributor

@matthewmueller matthewmueller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks a lot better, thanks the update!

@@ -63,6 +63,7 @@ func (c *CLI) Run(ctx context.Context, args ...string) error {
cli.Flag("embed", "embed assets").Bool(&cmd.Flag.Embed).Default(false)
cli.Flag("hot", "hot reloading").Bool(&cmd.Flag.Hot).Default(true)
cli.Flag("minify", "minify assets").Bool(&cmd.Flag.Minify).Default(false)
cli.Flag("open", "open browser on dev server startup").Bool(&cmd.Flag.OpenBrowser).Default(false)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah sorry, I might have missed this in the previous review but Flag is meant for global options that need to get passed into the framework. We should treat OpenBrowser like Listen below and stick it on the run command.

sneak added a commit to sneak/bud that referenced this pull request Dec 3, 2022
sneak added a commit to sneak/bud that referenced this pull request Dec 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feature suggestion: bud run should launch browser (maybe with a flag to enable?)
2 participants