Skip to content

Omit default from usage if DefValue is empty#205

Open
AdamSLevy wants to merge 5 commits into
spf13:masterfrom
AdamSLevy:master
Open

Omit default from usage if DefValue is empty#205
AdamSLevy wants to merge 5 commits into
spf13:masterfrom
AdamSLevy:master

Conversation

@AdamSLevy

Copy link
Copy Markdown

Fix #204

This change allows a user to set Flag.DefValue to an empty string to suppress the "(default %v)" printed in the usage line for custom Value types that have non-standard zero values.

For example

flags:=flag.NewFlagSet("",flag.ContinueOnError)
flags.VarPF(&myValue, "value", "", "usage").DefValue = ""

Will suppress the default message in the usage line.

@CLAassistant

CLAassistant commented Apr 24, 2019

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@erezpaz125

Copy link
Copy Markdown

Hi,
I wanted to know if this pull request could be approved (as I see all checks have passed)
It deals with an issue that came up at my workplace and it would be very helpful.
Thank you!

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.

Hide Default Value in usage for Value's with irregular zero values

3 participants