| 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 | } |
nothing calls this directly
no test coverage detected