pflag icon indicating copy to clipboard operation
pflag copied to clipboard

support VarPF variantes for options to return created flags

Open mandelsoft opened this issue 2 years ago • 1 comments

The actuals variants of the flag creation do not report back the generated Flag object. But this would be reqired to do further tweaking according to the public fields of a Flag, like adding of annotations.

Therefore it would be useful to have an additional variant of the option creation methods on a FlagSet, which returns the generated Flag object.

The underlying method VarPF already exists and can directly be used to support appropriate VarPF variants for the type specific methods.

For example func (f *FlagSet) StringVarPF(p *string, name, shorthand string, value string, usage string) *Flag

mandelsoft avatar Nov 01 '22 22:11 mandelsoft

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Nov 01 '22 22:11 CLAassistant