pflag icon indicating copy to clipboard operation
pflag copied to clipboard

Add hide default value in help/usage

Open nateph opened this issue 4 years ago • 3 comments

Currently if you add a default value through NoOptDefVal or DefValue, it gets printed in the help/usage message.

fs.StringVarP(&cs.Password, "password", "p", "default", "the password for a remote user supplied by -u or --user.")
fs.Lookup("password").NoOptDefVal = "default"

results in

-p, --password string[="default"]   the password for a remote user supplied by -u or --user. (default "default")

This field in the Flag type would omit the [="default"] and (default "default") additions.

nateph avatar Mar 03 '20 22:03 nateph

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Mar 03 '20 22:03 CLAassistant

#205

AdamSLevy avatar Mar 09 '20 08:03 AdamSLevy

Hi, can this PR be merged? This issue is relevant for a project at my workplace and it would help alot. Thank you!

erezpaz125 avatar Aug 07 '22 15:08 erezpaz125