Skip to content

Commit

Permalink
foamDictionary: Added -merge option
Browse files Browse the repository at this point in the history
which merges the new entry with the corresponding entry in the dictionary
  • Loading branch information
Henry Weller committed Dec 5, 2018
1 parent d6f538c commit abde9a8
Showing 1 changed file with 12 additions and 1 deletion.
Expand Up @@ -43,6 +43,9 @@ Usage
- \par -set \<value\> - \par -set \<value\>
Adds or replaces the entry Adds or replaces the entry
- \par -merge \<value\>
Merges the entry
- \par -remove - \par -remove
Remove the selected entry Remove the selected entry
Expand Down Expand Up @@ -263,6 +266,12 @@ int main(int argc, char *argv[])
"value", "value",
"Add a new entry" "Add a new entry"
); );
argList::addOption
(
"merge",
"value",
"Merge entry"
);
argList::addBoolOption argList::addBoolOption
( (
"remove", "remove",
Expand Down Expand Up @@ -366,9 +375,11 @@ int main(int argc, char *argv[])
( (
args.optionReadIfPresent("set", newValue) args.optionReadIfPresent("set", newValue)
|| args.optionReadIfPresent("add", newValue) || args.optionReadIfPresent("add", newValue)
|| args.optionReadIfPresent("merge", newValue)
) )
{ {
const bool overwrite = args.optionFound("set"); const bool overwrite = args.optionFound("set");
const bool merge = args.optionFound("merge");


Pair<word> dAk(dictAndKeyword(scopedName)); Pair<word> dAk(dictAndKeyword(scopedName));


Expand All @@ -382,7 +393,7 @@ int main(int argc, char *argv[])
} }
else else
{ {
const_cast<dictionary&>(d).add(ePtr, false); const_cast<dictionary&>(d).add(ePtr, merge);
} }
changed = true; changed = true;


Expand Down

0 comments on commit abde9a8

Please sign in to comment.