From f134892535f998e67182fc6e1e1f7ecf1b9fb7ba Mon Sep 17 00:00:00 2001 From: Julien Michel <julien.michel@cnes.fr> Date: Mon, 2 Oct 2017 17:07:15 +0200 Subject: [PATCH] ENH: Access to group ame / description in command-line launcher --- .../src/otbWrapperCommandLineLauncher.cxx | 51 ++++++++++--------- 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/Modules/Wrappers/CommandLine/src/otbWrapperCommandLineLauncher.cxx b/Modules/Wrappers/CommandLine/src/otbWrapperCommandLineLauncher.cxx index 5feeacc62c..a57140e827 100644 --- a/Modules/Wrappers/CommandLine/src/otbWrapperCommandLineLauncher.cxx +++ b/Modules/Wrappers/CommandLine/src/otbWrapperCommandLineLauncher.cxx @@ -721,11 +721,9 @@ std::string CommandLineLauncher::DisplayParameterHelp(const Parameter::Pointer & // Display the type the type ParameterType type = m_Application->GetParameterType(paramKey); - // Discard Group parameters (they don't need a value) - if (type == ParameterType_Group) - { - return ""; - } + std::string bigKey = paramKey; + + unsigned int maxKeySize = GetMaxKeySize(); bool singleSelectionForListView = false; @@ -745,10 +743,6 @@ std::string CommandLineLauncher::DisplayParameterHelp(const Parameter::Pointer & { oss << " "; } - - std::string bigKey = paramKey; - - unsigned int maxKeySize = GetMaxKeySize(); for(unsigned int i=0; i<maxKeySize-paramKey.size(); i++) bigKey.append(" "); @@ -784,6 +778,10 @@ std::string CommandLineLauncher::DisplayParameterHelp(const Parameter::Pointer & { oss << "<string list> "; } + else if(type == ParameterType_Group) + { + oss<< "<group> "; + } else itkExceptionMacro("Not handled parameter type."); @@ -831,30 +829,33 @@ std::string CommandLineLauncher::DisplayParameterHelp(const Parameter::Pointer & oss << "]"; } - if(m_Application->IsMandatory(paramKey)) - { - oss<<" (mandatory"; - } - else + if(type != ParameterType_Group) { - oss<<" (optional"; - if(m_Application->IsParameterEnabled(paramKey)) + if(m_Application->IsMandatory(paramKey)) { - oss<<", on by default"; + oss<<" (mandatory"; } else { - oss<<", off by default"; - } - } + oss<<" (optional"; - if(m_Application->HasValue(paramKey)) - { - oss<<", default value is "<<m_Application->GetParameterAsString(paramKey); + if(m_Application->IsParameterEnabled(paramKey)) + { + oss<<", on by default"; + } + else + { + oss<<", off by default"; + } + } + + if(m_Application->HasValue(paramKey)) + { + oss<<", default value is "<<m_Application->GetParameterAsString(paramKey); + } + oss<<")"; } - oss<<")"; - oss << std::endl; if(longHelp) -- GitLab