Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update the command line output to behave better #2726

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions src/helics/apps/Clone.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ void Clone::initialSetup()
{
if (!deactivated) {
fed->setFlagOption(HELICS_FLAG_OBSERVER);
if (outFileName.empty()) {
outFileName = "clone.json";
}
loadInputFiles();
}
}
Expand Down Expand Up @@ -374,9 +377,11 @@ std::shared_ptr<helicsCLI11App> Clone::buildArgParserApp()
app->add_flag("--allow_iteration", allow_iteration, "allow iteration on values")
->ignore_underscore();

app->add_option("--output,-o", outFileName, "the output file for recording the data")
->capture_default_str();
app->add_option("capture", captureFederate, "name of the federate to clone");
app->add_option(
"--capture,capture",
captureFederate,
"clone all the interfaces of a particular federate federate capture=\"fed1;fed2\" "
"supports multiple arguments or a semicolon/comma separated list");

return app;
}
Expand Down
1 change: 0 additions & 1 deletion src/helics/apps/Clone.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,6 @@ namespace apps {
std::map<std::string_view, int> eptNames; //!< translate endpoint name to index
std::string captureFederate; //!< storage for the name of the federate to clone
std::string fedConfig; //!< storage for the federateConfiguration
std::string outFileName{"clone.json"}; //!< the final output file
std::vector<int> pubPointCount; //!< a vector containing the counts of each publication
};

Expand Down
3 changes: 3 additions & 0 deletions src/helics/apps/Recorder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ void Recorder::initialSetup()
{
if (!deactivated) {
fed->setFlagOption(HELICS_FLAG_OBSERVER);
if (outFileName.empty()) {
outFileName = "out.txt";
}
loadInputFiles();
}
}
Expand Down
1 change: 0 additions & 1 deletion src/helics/apps/Recorder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,6 @@ namespace apps {
std::vector<ValueStats> vStat; //!< storage for statistics capture
std::vector<std::string> captureInterfaces; //!< storage for the interfaces to capture
std::string mapfile; //!< file name for the on-line file updater
std::string outFileName{"out.txt"}; //!< the final output file
};

} // namespace apps
Expand Down
2 changes: 2 additions & 0 deletions src/helics/apps/helicsApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ std::unique_ptr<helicsCLI11App> App::generateParser()
inputFileName,
"The primary input file containing app configuration")
->check(CLI::ExistingFile);
app->add_option("--output,-o", outFileName, "the output file for recording the data")
->capture_default_str();
app->allow_extras()->validate_positionals();
return app;
}
Expand Down
1 change: 1 addition & 0 deletions src/helics/apps/helicsApp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ configuration
Time stopTime = Time::maxVal(); //!< the time the App should stop
std::string configFileName; //!< name of the config file used for constructing the federate
std::string inputFileName; //!< the name of the app input file
std::string outFileName; //!< the name of any outputfile
bool useLocal{false};
bool fileLoaded{false};
bool deactivated{false};
Expand Down
14 changes: 14 additions & 0 deletions tests/helics/apps/test_files/trivialrec.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"autobroker":True,
"coretype":"test",
"subscriptions": [
{
"key": "pub1",
"type": "double"
},
{
"key": "pub2",
"type": "double"
}
]
}
Loading