Metadata fields can be used to control several run modes. These include:
logic-mode- Sets the CsvPath instance to operate in AND or OR modereturn-mode- Instructs the CsvPath instance to return matches or lines that did not matchprint-mode- Determines if the printouts fromprint()go to the terminal's standard out, or notvalidation-mode- Sets the validation reporting actions and channelsrun-mode- Indicates if a csvpath should be run by its CsvPath instanceunmatched-mode- Instructs CsvPath Framework to save unmatched lines, or notexplain-mode- If set, an explanation of the match results is dumped to INFO for each line processed
The values for each are:
logic-mode=ORorAND(ANDis the default)return-mode=no-matchesormatches(matchesis the default)print-mode=no-defaultordefault(defaultis the default)run-mode=no-runorrun(runis the default)explain-mode=no-explainorexplain(no-explainis the default)unmatched-mode=keeporno-keep(no-keepis the default)validation-mode= (one or more of the following separated by commas)printorno-print(printis on by default) and/orraiseorno-raiseand/orstoporno-stopfailorno-failcollectorno-collect
For more modes and more details about each, see csvpath.org.
The metadata settings happen after the parse() method and before collect(), fast_forward(), or next() evaluates the file. If neither the positive mode setting (e.g. print) or the negative (e.g. no-print) is found the fallback is the setting in config.ini, if applicable and there is one; otherwise, the default.
It is also possible, though not common, to set the modes programmatically.
Metadata-driven mode settings are effective only for the csvpath they are declared in. When you are using a CsvPaths instance to run multiple CsvPath instances, these mode fields give you a way to configure different behavior for each CsvPath in the run. Likewise, a production operator can configure a project-wide default setting in config.ini, while csvpath writers still have the option to override it on a csvpath-by-csvpath basis.