parseOptions

fnbool parseOptions(CFG)(ref CFG cfg, string opt)

initialize members of struct CFG from a string of sub-options.

fields of the struct are populated by listing them as space separated sub-options <field-name>:value, e.g. "precise:1 profile:1"

supported field value types:

  • strings (without spaces)
  • integer types (positive values only)
  • bool
  • float

If the struct has a member "help" it is called if it is found as a sub-option. If the struct has a member "errorName", is used as the name reported in error messages. Otherwise the struct name is used.