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

Method PrintFreeArgsDesc

library/cpp/getopt/small/last_getopt_opts.cpp:491–536  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

489 }
490
491 void TOpts::PrintFreeArgsDesc(IOutputStream& os, const NColorizer::TColors& colors) const {
492 if (0 == FreeArgsMax_)
493 return;
494
495 size_t leftFreeWidth = 0;
496 for (size_t i = 0; i < FreeArgSpecs_.size(); ++i) {
497 leftFreeWidth = Max(leftFreeWidth, GetFreeArgTitle(i).size());
498 }
499
500 if (!TrailingArgSpec_.IsDefault()) {
501 leftFreeWidth = Max(leftFreeWidth, TrailingArgSpec_.GetTitle(DefaultFreeArgTitle_).size());
502 }
503
504 leftFreeWidth = Min(leftFreeWidth, size_t(30));
505 os << Endl << colors.BoldColor() << "Free args" << colors.OldColor() << ":";
506
507 os << " min: " << colors.GreenColor() << FreeArgsMin_ << colors.OldColor() << ",";
508 os << " max: " << colors.GreenColor();
509 if (FreeArgsMax_ != UNLIMITED_ARGS) {
510 os << FreeArgsMax_;
511 } else {
512 os << "unlimited";
513 }
514 os << colors.OldColor() << Endl;
515
516 const size_t limit = GetTrailingArgsIndex();
517 for (size_t i = 0; i < limit; ++i) {
518 if (!FreeArgSpecs_.contains(i)) {
519 continue;
520 }
521
522 if (auto help = FreeArgSpecs_.at(i).GetHelp()) {
523 auto title = GetFreeArgTitle(i);
524 os << SPad << colors.GreenColor() << RightPad(title, leftFreeWidth, ' ') << colors.OldColor()
525 << SPad << help << Endl;
526 }
527 }
528
529 if (FreeArgsMax_ == UNLIMITED_ARGS) {
530 auto title = TrailingArgSpec_.GetTitle(DefaultFreeArgTitle_);
531 if (auto help = TrailingArgSpec_.GetHelp()) {
532 os << SPad << colors.GreenColor() << RightPad(title, leftFreeWidth, ' ') << colors.OldColor()
533 << SPad << help << Endl;
534 }
535 }
536 }
537}

Callers

nothing calls this directly

Calls 12

RightPadFunction · 0.85
GetTitleMethod · 0.80
BoldColorMethod · 0.80
OldColorMethod · 0.80
GreenColorMethod · 0.80
GetHelpMethod · 0.80
MaxFunction · 0.50
MinFunction · 0.50
sizeMethod · 0.45
IsDefaultMethod · 0.45
containsMethod · 0.45
atMethod · 0.45

Tested by

no test coverage detected