@@ -1187,44 +1187,36 @@ struct ConfigManager::ConfigManagerImpl
1187
1187
1188
1188
std::string
1189
1189
get_documentation_for_spec (const char * name) const {
1190
- std::string doc (name);
1190
+ std::ostringstream out;
1191
+ out << name;
1191
1192
1192
1193
auto it = m_spec.find (name);
1193
1194
if (it == m_spec.end ()) {
1194
- doc. append ( " : Not available" ) ;
1195
+ out << " : Not available" ;
1195
1196
} else {
1196
- doc.append (" \n " ).append (it->second ->description );
1197
-
1197
+ out << " \n " << it->second ->description ;
1198
1198
auto optdescrmap = options_for_config (*it->second ).get_option_descriptions ();
1199
1199
1200
1200
if (!optdescrmap.empty ()) {
1201
- doc.append (" \n Options:" );
1201
+ size_t len = 0 ;
1202
+ for (const auto &op : optdescrmap)
1203
+ len = std::max<size_t >(len, op.first .size ());
1204
+
1205
+ out << " \n Options:" ;
1202
1206
for (const auto &op : optdescrmap)
1203
- doc. append ( " \n " ). append ( op.first ). append ( " \n " ). append ( op.second ) ;
1207
+ util::pad_right (out << " \n " , op.first , len) << op.second ;
1204
1208
}
1205
1209
}
1206
1210
1207
- return doc ;
1211
+ return out. str () ;
1208
1212
}
1209
1213
1210
1214
std::vector<std::string>
1211
1215
get_docstrings () const {
1212
1216
std::vector<std::string> ret;
1213
1217
1214
- for (const auto &p : m_spec) {
1215
- std::string doc = p.first ;
1216
- doc.append (" \n " ).append (p.second ->description );
1217
-
1218
- auto optdescrmap = options_for_config (*p.second ).get_option_descriptions ();
1219
-
1220
- if (!optdescrmap.empty ()) {
1221
- doc.append (" \n Options:" );
1222
- for (const auto &op : optdescrmap)
1223
- doc.append (" \n " ).append (op.first ).append (" \n " ).append (op.second );
1224
- }
1225
-
1226
- ret.push_back (doc);
1227
- }
1218
+ for (const auto &p : m_spec)
1219
+ ret.push_back (get_documentation_for_spec (p.first .c_str ()));
1228
1220
1229
1221
return ret;
1230
1222
}
0 commit comments