From abde9a8a7c6313d1678adc38581973ec12a22bd9 Mon Sep 17 00:00:00 2001 From: Henry Weller Date: Wed, 5 Dec 2018 15:04:01 +0000 Subject: [PATCH] foamDictionary: Added -merge option which merges the new entry with the corresponding entry in the dictionary --- .../miscellaneous/foamDictionary/foamDictionary.C | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/applications/utilities/miscellaneous/foamDictionary/foamDictionary.C b/applications/utilities/miscellaneous/foamDictionary/foamDictionary.C index e3fb8f4cc2..edbc248dac 100644 --- a/applications/utilities/miscellaneous/foamDictionary/foamDictionary.C +++ b/applications/utilities/miscellaneous/foamDictionary/foamDictionary.C @@ -43,6 +43,9 @@ Usage - \par -set \ Adds or replaces the entry + - \par -merge \ + Merges the entry + - \par -remove Remove the selected entry @@ -263,6 +266,12 @@ int main(int argc, char *argv[]) "value", "Add a new entry" ); + argList::addOption + ( + "merge", + "value", + "Merge entry" + ); argList::addBoolOption ( "remove", @@ -366,9 +375,11 @@ int main(int argc, char *argv[]) ( args.optionReadIfPresent("set", newValue) || args.optionReadIfPresent("add", newValue) + || args.optionReadIfPresent("merge", newValue) ) { const bool overwrite = args.optionFound("set"); + const bool merge = args.optionFound("merge"); Pair dAk(dictAndKeyword(scopedName)); @@ -382,7 +393,7 @@ int main(int argc, char *argv[]) } else { - const_cast(d).add(ePtr, false); + const_cast(d).add(ePtr, merge); } changed = true;