MCPcopy Create free account
hub / github.com/catboost/catboost / AppendOption

Function AppendOption

contrib/libs/flatbuffers/src/flatc.cpp:285–322  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

283}
284
285static void AppendOption(std::stringstream &ss, const FlatCOption &option,
286 size_t max_col, size_t min_col_for_description) {
287 size_t chars = 2;
288 ss << " ";
289 if (!option.short_opt.empty()) {
290 chars += 2 + option.short_opt.length();
291 ss << "-" << option.short_opt;
292 if (!option.long_opt.empty()) {
293 chars++;
294 ss << ",";
295 }
296 ss << " ";
297 }
298 if (!option.long_opt.empty()) {
299 chars += 3 + option.long_opt.length();
300 ss << "--" << option.long_opt << " ";
301 }
302 if (!option.parameter.empty()) {
303 chars += 1 + option.parameter.length();
304 ss << option.parameter << " ";
305 }
306 size_t start_of_description = chars;
307 if (start_of_description > min_col_for_description) {
308 ss << "\n";
309 start_of_description = min_col_for_description;
310 ss << std::string(start_of_description, ' ');
311 } else {
312 while (start_of_description < min_col_for_description) {
313 ss << " ";
314 start_of_description++;
315 }
316 }
317 if (!option.description.empty()) {
318 std::string description = option.description;
319 AppendTextWrappedString(ss, description, max_col, start_of_description);
320 }
321 ss << "\n";
322}
323
324static void AppendShortOption(std::stringstream &ss,
325 const FlatCOption &option) {

Callers 1

GetUsageStringMethod · 0.85

Calls 4

AppendTextWrappedStringFunction · 0.85
stringClass · 0.50
emptyMethod · 0.45
lengthMethod · 0.45

Tested by

no test coverage detected