Skip to content

Commit

Permalink
Merge branch 'bugfix/issue_330_config_set_path' into 'main'
Browse files Browse the repository at this point in the history
Modify ovp8xx config set options

See merge request syntron/support/csr/ifm3d/ifm3d!415
  • Loading branch information
NikitaS20 committed Oct 24, 2024
2 parents 5425c1b + 83625fd commit 2513648
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion modules/tools/include/ifm3d/tools/common/config_set_app.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ namespace ifm3d
virtual CLI::App* CreateCommand(CLI::App* parent) override;

std::string config_file{"-"};
std::string path = "";
bool save;

}; // end: ConfigSetApp

Expand Down
19 changes: 9 additions & 10 deletions modules/tools/src/libifm3d_tools/common/config_set_app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,7 @@ ifm3d::ConfigSetApp::Execute(CLI::App* app)
std::string jstr;
std::string infile = this->config_file;

if (!this->path.empty())
{
jstr.assign(this->path);
}
else if (infile == "-")
if (infile == "-")
{
std::ostringstream buff;

Expand Down Expand Up @@ -59,6 +55,11 @@ ifm3d::ConfigSetApp::Execute(CLI::App* app)
(std::istreambuf_iterator<char>()));
}
device->FromJSONStr(jstr);

if (this->save)
{
std::static_pointer_cast<ifm3d::O3R>(device)->SaveInit();
}
}

CLI::App*
Expand All @@ -80,11 +81,9 @@ ifm3d::ConfigSetApp::CreateCommand(CLI::App* parent)

if (Parent<ifm3d::OVP8xx>())
{
command->add_option(
"--path",
this->path,
"Limit which part of the current configuration should be saved as "
"initial JSON. ");
command->add_flag("--save",
this->save,
"Save the new configuration as initial JSON");
}

return command;
Expand Down

0 comments on commit 2513648

Please sign in to comment.