Fix:(issue_2225) Make external flags more robust.
Use delegation to implement the Value+Flag paradigm used for other flag types.
Implement all of the Flag interfaces except Count.
Borrowed heavily from flag_bool.go and flag_generic.go
Add context to the error message when setting an external flag's value to its default value to avoid cryptic error messages like: "syntax error: expected file.go:234"
And suppress the error for odd-ball external flags that report the string representation of the zero-value of some structure as the default, but do not accept that string as input. Detect such odd-balls by their Get() method returning nil.
What type of PR is this?
- feature
What this PR does / why we need it:
Solve:
- cryptic error messages like "syntax error: expected flag.go:234"
- errors requiring external boolean flags have a value when used
- avoidable astonishment when AllowExtFlags flags behave differently from identical flags defined using urfave/cli
Which issue(s) this PR fixes:
Fixes #2225
Testing
Installed gfmrun and make passes. Also the same code passes the test cases for a large code base that uses the feature.
Release Notes
Improve support for `AllowExtFlags`