pflag icon indicating copy to clipboard operation
pflag copied to clipboard

Omit default from usage if DefValue is empty

Open AdamSLevy opened this issue 5 years ago • 2 comments

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.

AdamSLevy avatar Apr 24 '19 19:04 AdamSLevy

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Apr 24 '19 19:04 CLAassistant

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!

erezpaz125 avatar Aug 07 '22 15:08 erezpaz125