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

Method PrintHelp

library/cpp/getopt/small/modchooser.cpp:298–341  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

296}
297
298void TModChooser::PrintHelp(const TString& progName, bool toStdErr) const {
299 auto baseName = TFsPath(progName).Basename();
300 auto& out = toStdErr ? Cerr : Cout;
301 const auto& colors = toStdErr ? NColorizer::StdErr() : NColorizer::StdOut();
302 out << Description << Endl << Endl;
303 out << colors.BoldColor() << "Usage" << colors.OldColor() << ": " << baseName << " MODE [MODE_OPTIONS]" << Endl;
304 out << Endl;
305 out << colors.BoldColor() << "Modes" << colors.OldColor() << ":" << Endl;
306 size_t maxModeLen = 0;
307 for (const auto& [name, mode] : Modes) {
308 if (name != mode->Name)
309 continue; // this is an alias
310 maxModeLen = Max(maxModeLen, mode->CalculateFullNameLen());
311 }
312
313 if (ShowSeparated) {
314 for (const auto& unsortedMode : UnsortedModes)
315 if (!unsortedMode->Hidden) {
316 if (unsortedMode->Name.size()) {
317 out << " " << unsortedMode->FormatFullName(maxModeLen + 4, colors) << unsortedMode->Description << Endl;
318 } else {
319 out << SeparationString << Endl;
320 out << unsortedMode->Description << Endl;
321 }
322 }
323 } else {
324 for (const auto& mode : Modes) {
325 if (mode.first != mode.second->Name)
326 continue; // this is an alias
327
328 if (!mode.second->Hidden) {
329 out << " " << mode.second->FormatFullName(maxModeLen + 4, colors) << mode.second->Description << Endl;
330 }
331 }
332 }
333
334 out << Endl;
335 out << "To get help for specific mode type '" << baseName << " MODE " << ModesHelpOption << "'" << Endl;
336 if (VersionHandler)
337 out << "To print program version type '" << baseName << " --version'" << Endl;
338 if (!SvnRevisionOptionDisabled) {
339 out << "To print svn revision type '" << baseName << " --svnrevision'" << Endl;
340 }
341}
342
343TVersionHandlerPtr TModChooser::GetVersionHandler() const {
344 return VersionHandler;

Callers

nothing calls this directly

Calls 8

BoldColorMethod · 0.80
OldColorMethod · 0.80
CalculateFullNameLenMethod · 0.80
FormatFullNameMethod · 0.80
TFsPathClass · 0.50
MaxFunction · 0.50
BasenameMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected