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

vweb: add an option to disable startup message #17645

Merged
merged 5 commits into from
Mar 17, 2023

Conversation

ArthurZhou
Copy link
Contributor

add msg: false to vweb.RunParams to disable [VWeb] Running app on ...
refer to issue #17622

add an option msg: false to RunParams to disable the message
msg is true by default

example:

vweb.run_at(&App{}, vweb.RunParams{
		host: "localhost"
		port: 8080
		family: .ip
                msg: false
	})

vlib/vweb/vweb.v Outdated
@@ -387,6 +387,7 @@ pub struct RunParams {
host string
port int = 8080
family net.AddrFamily = .ip6 // use `family: .ip, host: 'localhost'` when you want it to bind only to 127.0.0.1
msg bool = true
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
msg bool = true
startup_message bool = true

vlib/vweb/vweb.v Outdated Show resolved Hide resolved
@JalonSolov
Copy link
Contributor

Hmm... is it better to have startup_msg as boolean?

What if you want to have a custom startup message?

@ArthurZhou
Copy link
Contributor Author

ArthurZhou commented Mar 14, 2023

You can print an output manually :)
e.g.

println("[Vweb] Running app on http://localhost:8080/")
vweb.run_at(&App{}, vweb.RunParams{
	host: "localhost"
	port: 8080
	family: .ip
	startup_message: false
})

@medvednikov
Copy link
Member

In V bools are usually named with is_x or show_x to make it clear they are bools.

startup_message sounds like a string, it should be show_startup_message: false

Verbose, but clear.

@spytheman
Copy link
Member

startup_message sounds like a string, it should be show_startup_message: false

indeed, my bad

@JalonSolov
Copy link
Contributor

To be truly explicit (and even more verbose), it should be show_default_startup_message - since it only affects the default.

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.

4 participants