lordgamez commented on code in PR #1956:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1956#discussion_r2032745867
##########
minifi_main/MiNiFiMain.cpp:
##########
@@ -196,6 +196,7 @@ int main(int argc, char **argv) {
.help("Generate documentation in the specified directory");
argument_parser.add_argument("-s", "--schema")
.metavar("PATH")
+ .default_value("-")
Review Comment:
This patch seems to be working for me:
```
diff --git a/minifi_main/MiNiFiMain.cpp b/minifi_main/MiNiFiMain.cpp
index 61d49a7bc..733b1194d 100644
--- a/minifi_main/MiNiFiMain.cpp
+++ b/minifi_main/MiNiFiMain.cpp
@@ -165,12 +165,14 @@ void overridePropertiesFromCommandLine(const
argparse::ArgumentParser& parser, c
if (!parser.is_used("--schema")) {
return std::nullopt;
}
- const auto& schema_path = parser.get("--schema");
- if (schema_path == "-") {
+ const auto& schema_path_args =
parser.get<std::vector<std::string>>("--schema");
+ if (schema_path_args.empty()) {
writeJsonSchema(configure, std::cout);
return 0;
}
+ const auto& schema_path = schema_path_args[0];
+
std::cout << "Writing json schema to " << schema_path << std::endl;
{
std::ofstream schema_file{schema_path};
@@ -196,8 +198,8 @@ int main(int argc, char **argv) {
.help("Generate documentation in the specified directory");
argument_parser.add_argument("-s", "--schema")
.metavar("PATH")
- .default_value("-")
- .help("Generate JSON schema to the specified path");
+ .nargs(0, 1)
+ .help("Generate JSON schema to the specified path. If no path is
specified, the schema will be printed to stdout");
try {
argument_parser.parse_args(argc, argv);
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]