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

Method PrintCmdLine

library/cpp/getopt/small/last_getopt_opts.cpp:325–362  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

323 }
324
325 void TOpts::PrintCmdLine(const TStringBuf& program, IOutputStream& os, const NColorizer::TColors& colors) const {
326 os << colors.BoldColor() << "Usage" << colors.OldColor() << ": ";
327 if (CustomUsage) {
328 os << CustomUsage;
329 } else {
330 os << program << " ";
331 }
332 if (CustomCmdLineDescr) {
333 os << CustomCmdLineDescr << Endl;
334 return;
335 }
336 os << "[OPTIONS]";
337
338 ui32 numDescribedFlags = GetTrailingArgsIndex();
339 ui32 numArgsToShow = Max(FreeArgsMin_, FreeArgsMax_ == UNLIMITED_ARGS ? numDescribedFlags : FreeArgsMax_);
340
341 for (ui32 i = 0, nonOptionalFlagsPrinted = 0; i < numArgsToShow; ++i) {
342 bool isOptional = nonOptionalFlagsPrinted >= FreeArgsMin_ || FreeArgSpecs_.Value(i, TFreeArgSpec()).Optional_;
343
344 nonOptionalFlagsPrinted += !isOptional;
345
346 os << " ";
347
348 if (isOptional)
349 os << "[";
350
351 os << GetFreeArgTitle(i);
352
353 if (isOptional)
354 os << "]";
355 }
356
357 if (FreeArgsMax_ == UNLIMITED_ARGS) {
358 os << " [" << TrailingArgSpec_.GetTitle(DefaultFreeArgTitle_) << "]...";
359 }
360
361 os << Endl;
362 }
363
364 void TOpts::PrintUsage(const TStringBuf& program, IOutputStream& osIn, const NColorizer::TColors& colors) const {
365 TStringStream os;

Callers

nothing calls this directly

Calls 6

TFreeArgSpecClass · 0.85
BoldColorMethod · 0.80
OldColorMethod · 0.80
GetTitleMethod · 0.80
MaxFunction · 0.50
ValueMethod · 0.45

Tested by

no test coverage detected