diff --git a/Documentation/Cookbook/Scripts/otbGenerateWrappersRstDoc.py b/Documentation/Cookbook/Scripts/otbGenerateWrappersRstDoc.py index d93f54555029d1b580f7a31d7a810ba01cb625ed..2a1ac0c5829b5f636ef43219882bfbd68550998d 100755 --- a/Documentation/Cookbook/Scripts/otbGenerateWrappersRstDoc.py +++ b/Documentation/Cookbook/Scripts/otbGenerateWrappersRstDoc.py @@ -228,10 +228,16 @@ def rst_parameter_value(app, key): raise ValueError("Cannot show parameter value for type ", type) def rst_parameter_flags(app, key): + """ + Display the mandatory and default value flags of a parameter + The display logic tries to follow the logic in WrapperCommandLineLauncher::DisplayParameterHelp + The default value is formatted using GetParameterAsString to use the same formatting as the cli interface + """ + if app.IsMandatory(key) and not app.HasValue(key): return "*Mandatory* " - elif app.HasValue(key) and app.GetParameterType(key) != ParameterType_Group: - return "*Default value: {}* ".format(app.GetParameterAsString(key)) # get value as string to use the same formatting as the c++ api + elif app.HasValue(key) and app.GetParameterType(key) != ParameterType_Group and app.GetParameterAsString(key) != "": + return "*Default value: {}* ".format(app.GetParameterAsString(key)) else: return "" diff --git a/Modules/Wrappers/ApplicationEngine/src/otbWrapperApplication.cxx b/Modules/Wrappers/ApplicationEngine/src/otbWrapperApplication.cxx index c755a4407f1d35abe468959eaf18efcc68a9c5d5..dbeac1e3aa3f65f2dfa68c8af67691c7f8026624 100644 --- a/Modules/Wrappers/ApplicationEngine/src/otbWrapperApplication.cxx +++ b/Modules/Wrappers/ApplicationEngine/src/otbWrapperApplication.cxx @@ -1995,9 +1995,15 @@ std::string Application::GetParameterAsString(std::string paramKey) { std::ostringstream oss; oss << std::setprecision(10); - const std::vector<std::string> strList = this->GetParameterStringList( paramKey ); - for (unsigned int i=0; i<strList.size(); i++) - oss << strList[i] << std::endl; + const std::vector<std::string> strList = this->GetParameterStringList(paramKey); + for (size_t i = 0; i < strList.size(); i++) + { + if (i != 0) + { + oss << " "; + } + oss << strList[i]; + } ret = oss.str(); } else