Skip to content

feature: automatically launch browser on bud run#334

Open
sneak wants to merge 2 commits into
livebud:mainfrom
sneak:sneak/open-browser
Open

feature: automatically launch browser on bud run#334
sneak wants to merge 2 commits into
livebud:mainfrom
sneak:sneak/open-browser

Conversation

@sneak
Copy link
Copy Markdown

@sneak sneak commented Nov 28, 2022

fixes #333

Copy link
Copy Markdown
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!

Comment thread internal/cli/run/run.go Outdated
Comment thread internal/cli/run/run.go Outdated
Comment thread internal/cli/run/run.go Outdated
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

Comment thread internal/cli/cli.go Outdated
Comment thread framework/framework.go Outdated
@sneak
Copy link
Copy Markdown
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
Copy Markdown
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!

Comment thread internal/cli/cli.go Outdated
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
Copy Markdown
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 sneak force-pushed the sneak/open-browser branch from abd4715 to 227541b Compare December 3, 2022 15:20
sneak added a commit to sneak/bud that referenced this pull request Dec 3, 2022
@sneak sneak force-pushed the sneak/open-browser branch from 227541b to 31e089c Compare December 3, 2022 15:22
@sneak sneak force-pushed the sneak/open-browser branch from 31e089c to 3ce87a8 Compare December 6, 2022 01:41
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