diff options
author | tldr <tldr@yandex-team.com> | 2024-03-28 18:47:44 +0300 |
---|---|---|
committer | tldr <tldr@yandex-team.com> | 2024-03-28 19:00:40 +0300 |
commit | bb09dae0c6200b95c94dcab806f758368955b08d (patch) | |
tree | 65fbf31370403d9c6f55d124a2100f0751101568 /library/cpp | |
parent | 369e2759174a2e7a4542fb4366ee0b9ec45b3f5a (diff) | |
download | ydb-bb09dae0c6200b95c94dcab806f758368955b08d.tar.gz |
[vcs]modchooser -h should not print colored if not TTY
56651679ad5f4f41f350a3f125a5604495e64dae
Diffstat (limited to 'library/cpp')
-rw-r--r-- | library/cpp/getopt/small/modchooser.cpp | 12 | ||||
-rw-r--r-- | library/cpp/getopt/small/modchooser.h | 2 |
2 files changed, 7 insertions, 7 deletions
diff --git a/library/cpp/getopt/small/modchooser.cpp b/library/cpp/getopt/small/modchooser.cpp index bc319089b7..3b3b0b7751 100644 --- a/library/cpp/getopt/small/modchooser.cpp +++ b/library/cpp/getopt/small/modchooser.cpp @@ -250,19 +250,19 @@ size_t TModChooser::TMode::CalculateFullNameLen() const { return len; } -TString TModChooser::TMode::FormatFullName(size_t pad) const { +TString TModChooser::TMode::FormatFullName(size_t pad, const NColorizer::TColors& colors) const { TStringBuilder name; if (Aliases) { name << "{"; } - name << NColorizer::StdErr().GreenColor(); + name << colors.GreenColor(); name << Name; - name << NColorizer::StdErr().OldColor(); + name << colors.OldColor(); if (Aliases) { for (const auto& alias : Aliases) { - name << "|" << NColorizer::StdErr().GreenColor() << alias << NColorizer::StdErr().OldColor(); + name << "|" << colors.GreenColor() << alias << colors.OldColor(); } name << "}"; } @@ -294,7 +294,7 @@ void TModChooser::PrintHelp(const TString& progName, bool toStdErr) const { for (const auto& unsortedMode : UnsortedModes) if (!unsortedMode->Hidden) { if (unsortedMode->Name.size()) { - out << " " << unsortedMode->FormatFullName(maxModeLen + 4) << unsortedMode->Description << Endl; + out << " " << unsortedMode->FormatFullName(maxModeLen + 4, colors) << unsortedMode->Description << Endl; } else { out << SeparationString << Endl; out << unsortedMode->Description << Endl; @@ -306,7 +306,7 @@ void TModChooser::PrintHelp(const TString& progName, bool toStdErr) const { continue; // this is an alias if (!mode.second->Hidden) { - out << " " << mode.second->FormatFullName(maxModeLen + 4) << mode.second->Description << Endl; + out << " " << mode.second->FormatFullName(maxModeLen + 4, colors) << mode.second->Description << Endl; } } } diff --git a/library/cpp/getopt/small/modchooser.h b/library/cpp/getopt/small/modchooser.h index 5ed64310c5..d41ae78005 100644 --- a/library/cpp/getopt/small/modchooser.h +++ b/library/cpp/getopt/small/modchooser.h @@ -124,7 +124,7 @@ public: // Full name includes primary name and aliases. Also, will add ANSI colors. size_t CalculateFullNameLen() const; - TString FormatFullName(size_t pad) const; + TString FormatFullName(size_t pad, const NColorizer::TColors& colors) const; }; TVector<const TMode*> GetUnsortedModes() const { |