Tweak format of option docstrings

This commit is contained in:
Maxime Coste 2016-08-07 10:47:26 +01:00
parent f73e89a716
commit ac0c746072

View File

@ -224,7 +224,9 @@ public:
return **it;
throw runtime_error(format("option '{}' already declared with different type or flags", name));
}
m_descs.emplace_back(new OptionDesc{name.str(), format("({}): {}", option_type_name<T>::name(), docstring), flags});
String doc = docstring.empty() ? format("[{}]", option_type_name<T>::name())
: format("[{}] - {}", option_type_name<T>::name(), docstring);
m_descs.emplace_back(new OptionDesc{name.str(), std::move(doc), flags});
opts.emplace_back(new TypedCheckedOption<T, validator>{m_global_manager, *m_descs.back(), value});
return *opts.back();
}