Commit 2ba8647b authored by Victor Poughon's avatar Victor Poughon

DOC: fix string list display formatting

parent db8fedab
...@@ -228,10 +228,16 @@ def rst_parameter_value(app, key): ...@@ -228,10 +228,16 @@ def rst_parameter_value(app, key):
raise ValueError("Cannot show parameter value for type ", type) raise ValueError("Cannot show parameter value for type ", type)
def rst_parameter_flags(app, key): 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): if app.IsMandatory(key) and not app.HasValue(key):
return "*Mandatory* " return "*Mandatory* "
elif app.HasValue(key) and app.GetParameterType(key) != ParameterType_Group: elif app.HasValue(key) and app.GetParameterType(key) != ParameterType_Group and app.GetParameterAsString(key) != "":
return "*Default value: {}* ".format(app.GetParameterAsString(key)) # get value as string to use the same formatting as the c++ api return "*Default value: {}* ".format(app.GetParameterAsString(key))
else: else:
return "" return ""
......
...@@ -1995,9 +1995,15 @@ std::string Application::GetParameterAsString(std::string paramKey) ...@@ -1995,9 +1995,15 @@ std::string Application::GetParameterAsString(std::string paramKey)
{ {
std::ostringstream oss; std::ostringstream oss;
oss << std::setprecision(10); oss << std::setprecision(10);
const std::vector<std::string> strList = this->GetParameterStringList( paramKey ); const std::vector<std::string> strList = this->GetParameterStringList(paramKey);
for (unsigned int i=0; i<strList.size(); i++) for (size_t i = 0; i < strList.size(); i++)
oss << strList[i] << std::endl; {
if (i != 0)
{
oss << " ";
}
oss << strList[i];
}
ret = oss.str(); ret = oss.str();
} }
else else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment