-
Notifications
You must be signed in to change notification settings - Fork 34
Description
Currently any reference to a FlagProp causes it to be set to true, e.g. this snippet in a properties file will set CREATE_SAMPLES to true:
org.yarnandtail.andhow.Options.CREATE_SAMPLES =
For most users, this would be unexpected and unwanted.
This causes issue #655 resulting unwanted requests for template creation... from using generated templates.
Its helpful to have a configuration template that is blank and ready to fill in, but in order to fix #655, FlagProp's have to be commented out.
It seems that Flag behavior is dependent on the loader being used (command-line loader) and the ValueType (it has to be a flag). Perhaps there is an undiscovered loader type for which the current flag behavior would also make sense, but I can't think of it.
Describe the solution you'd like
A FlagProp should behave like a BolProp with a default value, everywhere except when used on command line. To do that:
- Add
FlagValueType
interface with aparseAsFlag(sourceValue)
method and implement inFlagType
- The
StdMainStringArgsLoader
(and maybe its superclasses?) should override thecreateValue
method to call the newparseAsFlag
method forFlagValueType
s.
See #699 for reverting an original hack related to this issue.
Related: It seems like the createValue
method should 'trust' the ValueType parsers more. On line 199 it assumes that the parsers cannot deal with null, but maybe they can and want to do something special with null.