Skip to content
Snippets Groups Projects
Commit 29bff520 authored by Henry Weller's avatar Henry Weller
Browse files

foamDictionary: Added -value option to print the value associated with an entry

parent 2f847697
No related branches found
No related tags found
No related merge requests found
...@@ -242,19 +242,24 @@ int main(int argc, char *argv[]) ...@@ -242,19 +242,24 @@ int main(int argc, char *argv[])
argList::noBanner(); argList::noBanner();
argList::validArgs.append("dictionary"); argList::validArgs.append("dictionary");
argList::addBoolOption("keywords", "report keywords"); argList::addBoolOption("keywords", "list keywords");
argList::addOption("entry", "name", "report/select the named entry"); argList::addOption("entry", "name", "report/select the named entry");
argList::addBoolOption
(
"value",
"print entry value"
);
argList::addOption argList::addOption
( (
"set", "set",
"value", "value",
"changes existing entry or adds new entry" "set entry value or add new entry"
); );
argList::addOption argList::addOption
( (
"add", "add",
"value", "value",
"adds a new entry" "add a new entry"
); );
argList::addBoolOption argList::addBoolOption
( (
...@@ -356,7 +361,26 @@ int main(int argc, char *argv[]) ...@@ -356,7 +361,26 @@ int main(int argc, char *argv[])
} }
else else
{ {
Info<< *entPtr << endl; if (args.optionFound("value"))
{
if (entPtr->isStream())
{
const tokenList& tokens = entPtr->stream();
forAll(tokens, i)
{
Info<< tokens[i] << token::SPACE;
}
Info<< endl;
}
else if (entPtr->isDict())
{
Info<< entPtr->dict();
}
}
else
{
Info<< *entPtr << endl;
}
} }
} }
else else
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment