Skip to content

Commit

Permalink
Merge pull request #413 from silicon-heaven/add-cpon-option-to-shvcall
Browse files Browse the repository at this point in the history
add cpon option to shvcall
  • Loading branch information
fvacek authored Feb 12, 2024
2 parents f548d74 + b54b929 commit c74e75c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions examples/cli/shvcall/src/appclioptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ AppCliOptions::AppCliOptions()
addOption("path").setType(shv::chainpack::RpcValue::Type::String).setNames("--path").setComment("Shv call path");
addOption("method").setType(shv::chainpack::RpcValue::Type::String).setNames("--method").setComment("Shv call method");
addOption("params").setType(shv::chainpack::RpcValue::Type::String).setNames("--params").setComment("Shv call params");
addOption("isCponOutput").setType(shv::chainpack::RpcValue::Type::Bool).setNames("--cpon").setComment("Parse cpon output");
addOption("isChainPackOutput").setType(shv::chainpack::RpcValue::Type::Bool).setNames("-x", "--chainpack-output").setComment("ChainPack output");
}
1 change: 1 addition & 0 deletions examples/cli/shvcall/src/appclioptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ class AppCliOptions : public shv::iotqt::rpc::ClientAppCliOptions
CLIOPTION_GETTER_SETTER(std::string, m, setM, ethod)
CLIOPTION_GETTER_SETTER(std::string, p, setP, arams)
CLIOPTION_GETTER_SETTER(bool, isC, setC, hainPackOutput)
CLIOPTION_GETTER_SETTER(bool, isC, setC, ponOutput)
};
3 changes: 3 additions & 0 deletions examples/cli/shvcall/src/application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ void Application::onShvStateChanged()
if(m_cliOptions->isChainPackOutput()) {
std::cout << result.toChainPack();
}
else if (m_cliOptions->isCponOutput()) {
std::cout << cp::RpcValue::fromCpon(result.toString()).toCpon("\t") << "\n";
}
else {
std::cout << result.toCpon("\t") << "\n";
}
Expand Down

0 comments on commit c74e75c

Please sign in to comment.