core: Fix the command-line default string

Symptom:
When a command line parameter's default value string contains a white space, it is not printed in the help message

Root Cause Analysis:
While the construction of the stringstream of a particular data type can be arbitrarily designed, possibly including white spaces, the command-line class either inadvertentely failed to support a string including white spaces or intentionally decided not to support a white character in the default value string. The latter case is a design bug, if intended, because the command line class cannot enforce how a data type's string may be constructed.

Fix:
Take the whole string the stringstream constructs.
This commit is contained in:
Sébastien Deronne
2025-01-03 16:36:27 +01:00
parent ca702cff5f
commit 5075a60942

View File

@@ -742,7 +742,7 @@ CommandLine::AddValue(const std::string& name, const std::string& help, T& value
std::stringstream ss;
ss << value;
ss >> item->m_default;
item->m_default = ss.str(); // Including white spaces
m_options.push_back(item);
}