aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/getopt
diff options
context:
space:
mode:
authorVlad Yaroslavlev <vladon@vladon.com>2022-02-10 16:46:25 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:46:25 +0300
commit344ea37b4a345701ab0e67de2266a1c1bd7baf2d (patch)
tree1a2c5ffcf89eb53ecd79dbc9bc0a195c27404d0c /library/cpp/getopt
parent706b83ed7de5a473436620367af31fc0ceecde07 (diff)
downloadydb-344ea37b4a345701ab0e67de2266a1c1bd7baf2d.tar.gz
Restoring authorship annotation for Vlad Yaroslavlev <vladon@vladon.com>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/getopt')
-rw-r--r--library/cpp/getopt/print.cpp4
-rw-r--r--library/cpp/getopt/small/last_getopt_opt.h2
-rw-r--r--library/cpp/getopt/small/last_getopt_opts.cpp4
-rw-r--r--library/cpp/getopt/small/last_getopt_parser.cpp2
-rw-r--r--library/cpp/getopt/small/last_getopt_support.h2
-rw-r--r--library/cpp/getopt/small/modchooser.cpp8
-rw-r--r--library/cpp/getopt/small/modchooser.h20
-rw-r--r--library/cpp/getopt/small/opt.h2
-rw-r--r--library/cpp/getopt/small/opt2.cpp4
-rw-r--r--library/cpp/getopt/small/opt2.h16
-rw-r--r--library/cpp/getopt/small/ygetopt.cpp12
-rw-r--r--library/cpp/getopt/ut/last_getopt_ut.cpp92
-rw-r--r--library/cpp/getopt/ut/opt_ut.cpp4
-rw-r--r--library/cpp/getopt/ut/posix_getopt_ut.cpp4
-rw-r--r--library/cpp/getopt/ut/ygetopt_ut.cpp4
15 files changed, 90 insertions, 90 deletions
diff --git a/library/cpp/getopt/print.cpp b/library/cpp/getopt/print.cpp
index 57c244f333..8cf1c62e4d 100644
--- a/library/cpp/getopt/print.cpp
+++ b/library/cpp/getopt/print.cpp
@@ -10,7 +10,7 @@
#include <library/cpp/build_info/build_info.h>
namespace NLastGetoptPrivate {
- TString InitVersionString() {
+ TString InitVersionString() {
TString ts = GetProgramSvnVersion();
ts += "\n";
ts += GetBuildInfo();
@@ -27,7 +27,7 @@ namespace NLastGetoptPrivate {
return ts;
}
- TString& VersionString();
+ TString& VersionString();
TString& ShortVersionString();
struct TInit {
diff --git a/library/cpp/getopt/small/last_getopt_opt.h b/library/cpp/getopt/small/last_getopt_opt.h
index fe6c2c064d..a8dd5adca9 100644
--- a/library/cpp/getopt/small/last_getopt_opt.h
+++ b/library/cpp/getopt/small/last_getopt_opt.h
@@ -5,7 +5,7 @@
#include <util/string/split.h>
#include <util/generic/ptr.h>
-#include <util/generic/string.h>
+#include <util/generic/string.h>
#include <util/generic/maybe.h>
#include <util/generic/vector.h>
#include <util/string/cast.h>
diff --git a/library/cpp/getopt/small/last_getopt_opts.cpp b/library/cpp/getopt/small/last_getopt_opts.cpp
index 13c327af12..03c432849f 100644
--- a/library/cpp/getopt/small/last_getopt_opts.cpp
+++ b/library/cpp/getopt/small/last_getopt_opts.cpp
@@ -11,8 +11,8 @@
#include <stdlib.h>
namespace NLastGetoptPrivate {
- TString& VersionString() {
- static TString data;
+ TString& VersionString() {
+ static TString data;
return data;
}
TString& ShortVersionString() {
diff --git a/library/cpp/getopt/small/last_getopt_parser.cpp b/library/cpp/getopt/small/last_getopt_parser.cpp
index cf04841fd4..7668b12a03 100644
--- a/library/cpp/getopt/small/last_getopt_parser.cpp
+++ b/library/cpp/getopt/small/last_getopt_parser.cpp
@@ -124,7 +124,7 @@ namespace NLastGetopt {
if (opt->GetHasArg() == NO_ARGUMENT) {
return Commit(opt, nullptr, pos, p);
}
- return Commit(opt, arg.SubStr(p), pos + 1, 0);
+ return Commit(opt, arg.SubStr(p), pos + 1, 0);
}
bool TOptsParser::ParseShortOptArg(size_t pos) {
diff --git a/library/cpp/getopt/small/last_getopt_support.h b/library/cpp/getopt/small/last_getopt_support.h
index 72474578c5..17bed3e614 100644
--- a/library/cpp/getopt/small/last_getopt_support.h
+++ b/library/cpp/getopt/small/last_getopt_support.h
@@ -1,7 +1,7 @@
#pragma once
#include <util/string/cast.h>
-#include <util/generic/string.h>
+#include <util/generic/string.h>
#include <util/generic/vector.h>
#include <util/generic/utility.h>
#include <util/generic/yexception.h>
diff --git a/library/cpp/getopt/small/modchooser.cpp b/library/cpp/getopt/small/modchooser.cpp
index f6e091fb2d..2fa5cfd070 100644
--- a/library/cpp/getopt/small/modchooser.cpp
+++ b/library/cpp/getopt/small/modchooser.cpp
@@ -128,11 +128,11 @@ void TModChooser::AddAlias(const TString& alias, const TString& mode) {
Modes[alias] = Modes[mode];
}
-void TModChooser::SetDescription(const TString& descr) {
+void TModChooser::SetDescription(const TString& descr) {
Description = descr;
}
-void TModChooser::SetModesHelpOption(const TString& helpOption) {
+void TModChooser::SetModesHelpOption(const TString& helpOption) {
ModesHelpOption = helpOption;
}
@@ -144,7 +144,7 @@ void TModChooser::SetSeparatedMode(bool separated) {
ShowSeparated = separated;
}
-void TModChooser::SetSeparationString(const TString& str) {
+void TModChooser::SetSeparationString(const TString& str) {
SeparationString = str;
}
@@ -277,7 +277,7 @@ TString TModChooser::TMode::FormatFullName(size_t pad) const {
return name;
}
-void TModChooser::PrintHelp(const TString& progName) const {
+void TModChooser::PrintHelp(const TString& progName) const {
Cerr << Description << Endl << Endl;
Cerr << NColorizer::StdErr().BoldColor() << "Usage" << NColorizer::StdErr().OldColor() << ": " << progName << " MODE [MODE_OPTIONS]" << Endl;
Cerr << Endl;
diff --git a/library/cpp/getopt/small/modchooser.h b/library/cpp/getopt/small/modchooser.h
index 656e007489..0a8de6d50b 100644
--- a/library/cpp/getopt/small/modchooser.h
+++ b/library/cpp/getopt/small/modchooser.h
@@ -3,7 +3,7 @@
#include "last_getopt_opts.h"
#include <util/generic/map.h>
-#include <util/generic/string.h>
+#include <util/generic/string.h>
#include <util/generic/vector.h>
#include <functional>
@@ -63,10 +63,10 @@ public:
void AddAlias(const TString& alias, const TString& mode);
//! Set main program description.
- void SetDescription(const TString& descr);
+ void SetDescription(const TString& descr);
//! Set modes help option name (-? is by default)
- void SetModesHelpOption(const TString& helpOption);
+ void SetModesHelpOption(const TString& helpOption);
//! Specify handler for '--version' parameter
void SetVersionHandler(TVersionHandlerPtr handler);
@@ -75,7 +75,7 @@ public:
void SetSeparatedMode(bool separated = true);
//! Set separation string
- void SetSeparationString(const TString& str);
+ void SetSeparationString(const TString& str);
//! Set short command representation in Usage block
void SetPrintShortCommandInUsage(bool printShortCommandInUsage);
@@ -100,12 +100,12 @@ public:
//! Run appropriate mode. Same as Run(const int, const char**)
int Run(const TVector<TString>& argv) const;
- void PrintHelp(const TString& progName) const;
+ void PrintHelp(const TString& progName) const;
struct TMode {
- TString Name;
+ TString Name;
TMainClass* Main;
- TString Description;
+ TString Description;
bool Hidden;
bool NoCompletion;
TVector<TString> Aliases;
@@ -136,10 +136,10 @@ public:
private:
//! Main program description.
- TString Description;
+ TString Description;
//! Help option for modes.
- TString ModesHelpOption;
+ TString ModesHelpOption;
//! Wrappers around all modes.
TVector<THolder<TMainClass>> Wrappers;
@@ -162,7 +162,7 @@ private:
bool PrintShortCommandInUsage;
//! Text string used when displaying each separator
- TString SeparationString;
+ TString SeparationString;
//! Unsorted list of options
TVector<THolder<TMode>> UnsortedModes;
diff --git a/library/cpp/getopt/small/opt.h b/library/cpp/getopt/small/opt.h
index b18f06d6e0..ecb57439bc 100644
--- a/library/cpp/getopt/small/opt.h
+++ b/library/cpp/getopt/small/opt.h
@@ -93,7 +93,7 @@ public:
return Arg;
}
- TVector<TString> GetFreeArgs() const {
+ TVector<TString> GetFreeArgs() const {
return NLastGetopt::TOptsParseResult(&*Opts_, GetArgC(), GetArgV()).GetFreeArgs();
}
diff --git a/library/cpp/getopt/small/opt2.cpp b/library/cpp/getopt/small/opt2.cpp
index 2816aef7a5..0cdc774e78 100644
--- a/library/cpp/getopt/small/opt2.cpp
+++ b/library/cpp/getopt/small/opt2.cpp
@@ -57,7 +57,7 @@ void Opt2::EatArgv(const char* optspec, const char* long_alias) {
// long_alias has a form "long-name1=A,long-name2=B", etc.
// This implementation is limited to aliasing a single long option
// with single short option (extend it if you really need).
- THashMap<const char*, char> long2short;
+ THashMap<const char*, char> long2short;
long2short["help"] = '?';
long_alias = long_alias ? long_alias : "";
alias_copy = long_alias;
@@ -105,7 +105,7 @@ void Opt2::EatArgv(const char* optspec, const char* long_alias) {
}
// long option always spans one argv (--switch or --option-name=value)
const char* eq = strchr(s, '=');
- TString lname(s, eq ? (size_t)(eq - s) : (size_t)strlen(s));
+ TString lname(s, eq ? (size_t)(eq - s) : (size_t)strlen(s));
THashMap<const char*, char>::iterator i = long2short.find(lname.data());
if (i == long2short.end()) {
UnknownLongOption = strdup(lname.data()); // free'd in AutoUsage()
diff --git a/library/cpp/getopt/small/opt2.h b/library/cpp/getopt/small/opt2.h
index 70b2701122..4d9d943237 100644
--- a/library/cpp/getopt/small/opt2.h
+++ b/library/cpp/getopt/small/opt2.h
@@ -1,7 +1,7 @@
#pragma once
#include <util/system/defaults.h>
-#include <util/generic/string.h>
+#include <util/generic/string.h>
#include <util/generic/vector.h>
// simplified options parser
@@ -31,9 +31,9 @@ struct Opt2Param {
bool IsRequired;
bool MultipleUse;
const char* DefValue;
- TString DefValueStr;
- TString HelpUsage;
- TVector<const char*> ActualValue;
+ TString DefValueStr;
+ TString HelpUsage;
+ TVector<const char*> ActualValue;
const char* LongOptName;
Opt2Param()
: HasArg(false)
@@ -112,7 +112,7 @@ public:
public:
// non-option args
- TVector<char*> Pos;
+ TVector<char*> Pos;
bool HasErrors;
private:
@@ -122,15 +122,15 @@ private:
char OptionMissingArg;
char OptionWrongArg;
char RequiredOptionMissing;
- TVector<TString> UserErrorMessages;
+ TVector<TString> UserErrorMessages;
protected:
int Argc;
char* const* Argv;
int MinArgs, MaxArgs;
ui8 SpecsMap[256];
- TVector<Opt2Param> Specs;
- TString alias_copy;
+ TVector<Opt2Param> Specs;
+ TString alias_copy;
void EatArgv(const char* optspec, const char* long_alias);
void Clear();
Opt2Param& GetInternal(char opt, const char* defValue, const char* helpUsage, bool required);
diff --git a/library/cpp/getopt/small/ygetopt.cpp b/library/cpp/getopt/small/ygetopt.cpp
index f11e39588e..1f52827f74 100644
--- a/library/cpp/getopt/small/ygetopt.cpp
+++ b/library/cpp/getopt/small/ygetopt.cpp
@@ -1,7 +1,7 @@
#include "opt.h"
#include "ygetopt.h"
-#include <util/generic/string.h>
+#include <util/generic/string.h>
#include <util/generic/vector.h>
#include <util/generic/yexception.h>
@@ -67,7 +67,7 @@ private:
const char* Arg_;
};
-TGetOpt::TIterator::TIterator() noexcept
+TGetOpt::TIterator::TIterator() noexcept
: Impl_(nullptr)
{
}
@@ -82,11 +82,11 @@ void TGetOpt::TIterator::Next() {
Impl_->Next();
}
-char TGetOpt::TIterator::Key() const noexcept {
+char TGetOpt::TIterator::Key() const noexcept {
return Impl_->Key();
}
-bool TGetOpt::TIterator::AtEnd() const noexcept {
+bool TGetOpt::TIterator::AtEnd() const noexcept {
if (Impl_.Get()) {
return Impl_->AtEnd();
}
@@ -94,7 +94,7 @@ bool TGetOpt::TIterator::AtEnd() const noexcept {
return true;
}
-const char* TGetOpt::TIterator::Arg() const noexcept {
+const char* TGetOpt::TIterator::Arg() const noexcept {
if (Impl_.Get()) {
return Impl_->Arg();
}
@@ -102,7 +102,7 @@ const char* TGetOpt::TIterator::Arg() const noexcept {
return nullptr;
}
-TGetOpt::TGetOpt(int argc, const char* const* argv, const TString& format)
+TGetOpt::TGetOpt(int argc, const char* const* argv, const TString& format)
: Impl_(new TImpl(argc, argv, format))
{
}
diff --git a/library/cpp/getopt/ut/last_getopt_ut.cpp b/library/cpp/getopt/ut/last_getopt_ut.cpp
index d35a493021..c99a1d053d 100644
--- a/library/cpp/getopt/ut/last_getopt_ut.cpp
+++ b/library/cpp/getopt/ut/last_getopt_ut.cpp
@@ -19,22 +19,22 @@ namespace {
};
class TOptsParseResultTestWrapper: public TOptsParseResultException {
- TVector<const char*> Argv_;
+ TVector<const char*> Argv_;
public:
- TOptsParseResultTestWrapper(const TOpts* opts, TVector<const char*> argv)
+ TOptsParseResultTestWrapper(const TOpts* opts, TVector<const char*> argv)
: Argv_(argv)
{
Init(opts, (int)Argv_.size(), Argv_.data());
}
};
- using V = TVector<const char*>;
+ using V = TVector<const char*>;
}
struct TOptsParserTester {
TOptsNoDefault Opts_;
- TVector<const char*> Argv_;
+ TVector<const char*> Argv_;
THolder<TOptsParser> Parser_;
@@ -58,13 +58,13 @@ struct TOptsParserTester {
UNIT_ASSERT(Parser_->CurOpt()->CharIs(c));
}
- void AcceptOption(const TString& optName) {
+ void AcceptOption(const TString& optName) {
AcceptOption();
UNIT_ASSERT(Parser_->CurOpt()->NameIs(optName));
}
template <typename TOpt>
- void AcceptOptionWithValue(TOpt optName, const TString& value) {
+ void AcceptOptionWithValue(TOpt optName, const TString& value) {
AcceptOption(optName);
UNIT_ASSERT_VALUES_EQUAL_C(value, Parser_->CurValStr(), "; option " << optName);
}
@@ -75,7 +75,7 @@ struct TOptsParserTester {
UNIT_ASSERT_C(!Parser_->CurVal(), ": opt " << optName << " must have no param");
}
- void AcceptFreeArgInOrder(const TString& expected) {
+ void AcceptFreeArgInOrder(const TString& expected) {
Accept();
UNIT_ASSERT(!Parser_->CurOpt());
UNIT_ASSERT_VALUES_EQUAL(expected, Parser_->CurValStr());
@@ -114,7 +114,7 @@ struct TOptsParserTester {
UNIT_ASSERT_VALUES_EQUAL(sop, Parser_->Sop_);
}
- void AcceptFreeArg(const TString& expected) {
+ void AcceptFreeArg(const TString& expected) {
UNIT_ASSERT(Pos_ < Parser_->Argc_);
UNIT_ASSERT_VALUES_EQUAL(expected, Parser_->Argv_[Pos_]);
++Pos_;
@@ -417,7 +417,7 @@ Y_UNIT_TEST_SUITE(TLastGetoptTests) {
Y_UNIT_TEST(TestStoreResult) {
TOptsNoDefault opts;
- TString data;
+ TString data;
int number;
TMaybe<TString> optionalString0, optionalString1;
TMaybe<int> optionalNumber0, optionalNumber1;
@@ -483,10 +483,10 @@ Y_UNIT_TEST_SUITE(TLastGetoptTests) {
Y_UNIT_TEST(TestSplitValue) {
TOptsNoDefault opts;
- TVector<TString> vals;
+ TVector<TString> vals;
opts.AddLongOption('s', "split").SplitHandler(&vals, ',');
TOptsParseResultTestWrapper r(&opts, V({"prog", "--split=a,b,c"}));
- UNIT_ASSERT_EQUAL(vals.size(), 3);
+ UNIT_ASSERT_EQUAL(vals.size(), 3);
UNIT_ASSERT_EQUAL(vals[0], "a");
UNIT_ASSERT_EQUAL(vals[1], "b");
UNIT_ASSERT_EQUAL(vals[2], "c");
@@ -494,10 +494,10 @@ Y_UNIT_TEST_SUITE(TLastGetoptTests) {
Y_UNIT_TEST(TestRangeSplitValue) {
TOptsNoDefault opts;
- TVector<ui32> vals;
+ TVector<ui32> vals;
opts.AddLongOption('s', "split").RangeSplitHandler(&vals, ',', '-');
TOptsParseResultTestWrapper r(&opts, V({"prog", "--split=1,8-10", "--split=12-14"}));
- UNIT_ASSERT_EQUAL(vals.size(), 7);
+ UNIT_ASSERT_EQUAL(vals.size(), 7);
UNIT_ASSERT_EQUAL(vals[0], 1);
UNIT_ASSERT_EQUAL(vals[1], 8);
UNIT_ASSERT_EQUAL(vals[2], 9);
@@ -577,7 +577,7 @@ Y_UNIT_TEST_SUITE(TLastGetoptTests) {
Y_UNIT_TEST(TestTitleAndPrintUsage) {
TOpts opts;
const char* prog = "my_program";
- TString title = TString("Sample ") + TString(prog).Quote() + " application";
+ TString title = TString("Sample ") + TString(prog).Quote() + " application";
opts.SetTitle(title);
int argc = 2;
const char* cmd[] = {prog};
@@ -585,15 +585,15 @@ Y_UNIT_TEST_SUITE(TLastGetoptTests) {
TStringStream out;
parser.PrintUsage(out);
// find title
- UNIT_ASSERT(out.Str().find(title) != TString::npos);
+ UNIT_ASSERT(out.Str().find(title) != TString::npos);
// find usage
- UNIT_ASSERT(out.Str().find(" " + TString(prog) + " ") != TString::npos);
+ UNIT_ASSERT(out.Str().find(" " + TString(prog) + " ") != TString::npos);
}
Y_UNIT_TEST(TestCustomCmdLineDescr) {
TOpts opts;
const char* prog = "my_program";
- TString customDescr = "<FILE|TABLE> USER [OPTIONS]";
+ TString customDescr = "<FILE|TABLE> USER [OPTIONS]";
int argc = 2;
const char* cmd[] = {prog};
opts.SetCmdLineDescr(customDescr);
@@ -601,7 +601,7 @@ Y_UNIT_TEST_SUITE(TLastGetoptTests) {
TStringStream out;
parser.PrintUsage(out);
// find custom usage
- UNIT_ASSERT(out.Str().find(customDescr) != TString::npos);
+ UNIT_ASSERT(out.Str().find(customDescr) != TString::npos);
}
Y_UNIT_TEST(TestColorPrint) {
@@ -622,28 +622,28 @@ Y_UNIT_TEST_SUITE(TLastGetoptTests) {
parser.PrintUsage(out, colors);
// find options and green color
- UNIT_ASSERT(out.Str().find(TStringBuilder() << colors.GreenColor() << "--long_option" << colors.OldColor()) != TString::npos);
- UNIT_ASSERT(out.Str().find(TStringBuilder() << colors.GreenColor() << "--other" << colors.OldColor()) != TString::npos);
- UNIT_ASSERT(out.Str().find(TStringBuilder() << colors.GreenColor() << "-o" << colors.OldColor()) != TString::npos);
- UNIT_ASSERT(out.Str().find(TStringBuilder() << colors.GreenColor() << "-d" << colors.OldColor()) != TString::npos);
- UNIT_ASSERT(out.Str().find(TStringBuilder() << colors.GreenColor() << "-s" << colors.OldColor()) != TString::npos);
+ UNIT_ASSERT(out.Str().find(TStringBuilder() << colors.GreenColor() << "--long_option" << colors.OldColor()) != TString::npos);
+ UNIT_ASSERT(out.Str().find(TStringBuilder() << colors.GreenColor() << "--other" << colors.OldColor()) != TString::npos);
+ UNIT_ASSERT(out.Str().find(TStringBuilder() << colors.GreenColor() << "-o" << colors.OldColor()) != TString::npos);
+ UNIT_ASSERT(out.Str().find(TStringBuilder() << colors.GreenColor() << "-d" << colors.OldColor()) != TString::npos);
+ UNIT_ASSERT(out.Str().find(TStringBuilder() << colors.GreenColor() << "-s" << colors.OldColor()) != TString::npos);
// find default values
- UNIT_ASSERT(out.Str().find(TStringBuilder() << colors.CyanColor() << "42" << colors.OldColor()) != TString::npos);
- UNIT_ASSERT(out.Str().find(TStringBuilder() << colors.CyanColor() << "\"str_default\"" << colors.OldColor()) != TString::npos);
+ UNIT_ASSERT(out.Str().find(TStringBuilder() << colors.CyanColor() << "42" << colors.OldColor()) != TString::npos);
+ UNIT_ASSERT(out.Str().find(TStringBuilder() << colors.CyanColor() << "\"str_default\"" << colors.OldColor()) != TString::npos);
// find free args
- UNIT_ASSERT(out.Str().find(TStringBuilder() << colors.GreenColor() << "123" << colors.OldColor()) != TString::npos);
- UNIT_ASSERT(out.Str().find(TStringBuilder() << colors.GreenColor() << "456" << colors.OldColor()) != TString::npos);
- UNIT_ASSERT(out.Str().find(TStringBuilder() << colors.GreenColor() << "first_free_arg" << colors.OldColor()) != TString::npos);
+ UNIT_ASSERT(out.Str().find(TStringBuilder() << colors.GreenColor() << "123" << colors.OldColor()) != TString::npos);
+ UNIT_ASSERT(out.Str().find(TStringBuilder() << colors.GreenColor() << "456" << colors.OldColor()) != TString::npos);
+ UNIT_ASSERT(out.Str().find(TStringBuilder() << colors.GreenColor() << "first_free_arg" << colors.OldColor()) != TString::npos);
// free args without help not rendered even if they have custom title
UNIT_ASSERT(out.Str().find(TStringBuilder() << colors.GreenColor() << "second_free_arg" << colors.OldColor()) == TString::npos);
// find signatures
- UNIT_ASSERT(out.Str().find(TStringBuilder() << colors.BoldColor() << "Usage" << colors.OldColor()) != TString::npos);
- UNIT_ASSERT(out.Str().find(TStringBuilder() << colors.BoldColor() << "Required parameters" << colors.OldColor()) != TString::npos);
- UNIT_ASSERT(out.Str().find(TStringBuilder() << colors.BoldColor() << "Optional parameters" << colors.OldColor()) != TString::npos);
- UNIT_ASSERT(out.Str().find(TStringBuilder() << colors.BoldColor() << "Free args" << colors.OldColor()) != TString::npos);
+ UNIT_ASSERT(out.Str().find(TStringBuilder() << colors.BoldColor() << "Usage" << colors.OldColor()) != TString::npos);
+ UNIT_ASSERT(out.Str().find(TStringBuilder() << colors.BoldColor() << "Required parameters" << colors.OldColor()) != TString::npos);
+ UNIT_ASSERT(out.Str().find(TStringBuilder() << colors.BoldColor() << "Optional parameters" << colors.OldColor()) != TString::npos);
+ UNIT_ASSERT(out.Str().find(TStringBuilder() << colors.BoldColor() << "Free args" << colors.OldColor()) != TString::npos);
// find sections
UNIT_ASSERT(out.Str().find(TStringBuilder() << colors.BoldColor() << "Section" << colors.OldColor() << ":") != TString::npos);
@@ -652,10 +652,10 @@ Y_UNIT_TEST_SUITE(TLastGetoptTests) {
// print without colors
TStringStream out2;
opts.PrintUsage(prog, out2);
- UNIT_ASSERT(out2.Str().find(colors.GreenColor()) == TString::npos);
- UNIT_ASSERT(out2.Str().find(colors.CyanColor()) == TString::npos);
- UNIT_ASSERT(out2.Str().find(colors.BoldColor()) == TString::npos);
- UNIT_ASSERT(out2.Str().find(colors.OldColor()) == TString::npos);
+ UNIT_ASSERT(out2.Str().find(colors.GreenColor()) == TString::npos);
+ UNIT_ASSERT(out2.Str().find(colors.CyanColor()) == TString::npos);
+ UNIT_ASSERT(out2.Str().find(colors.BoldColor()) == TString::npos);
+ UNIT_ASSERT(out2.Str().find(colors.OldColor()) == TString::npos);
}
Y_UNIT_TEST(TestPadding) {
@@ -675,21 +675,21 @@ Y_UNIT_TEST_SUITE(TLastGetoptTests) {
NColorizer::TColors colors(withColors);
parser.PrintUsage(out, colors);
- TString printed = out.Str();
+ TString printed = out.Str();
if (withColors) {
// remove not printable characters
- SubstGlobal(printed, TString(colors.BoldColor()), "");
- SubstGlobal(printed, TString(colors.GreenColor()), "");
- SubstGlobal(printed, TString(colors.CyanColor()), "");
- SubstGlobal(printed, TString(colors.OldColor()), "");
+ SubstGlobal(printed, TString(colors.BoldColor()), "");
+ SubstGlobal(printed, TString(colors.GreenColor()), "");
+ SubstGlobal(printed, TString(colors.CyanColor()), "");
+ SubstGlobal(printed, TString(colors.OldColor()), "");
}
- TVector<TString> lines;
+ TVector<TString> lines;
StringSplitter(printed).Split('\n').SkipEmpty().Collect(&lines);
UNIT_ASSERT(!lines.empty());
- TVector<size_t> indents;
- for (const TString& line : lines) {
+ TVector<size_t> indents;
+ for (const TString& line : lines) {
const size_t indent = line.find("description ");
- if (indent != TString::npos)
+ if (indent != TString::npos)
indents.push_back(indent);
}
UNIT_ASSERT_VALUES_EQUAL(indents.size(), 7);
@@ -701,7 +701,7 @@ Y_UNIT_TEST_SUITE(TLastGetoptTests) {
}
Y_UNIT_TEST(TestAppendTo) {
- TVector<int> ints;
+ TVector<int> ints;
TOptsNoDefault opts;
opts.AddLongOption("size").AppendTo(&ints);
diff --git a/library/cpp/getopt/ut/opt_ut.cpp b/library/cpp/getopt/ut/opt_ut.cpp
index aad842a46e..441aa493a0 100644
--- a/library/cpp/getopt/ut/opt_ut.cpp
+++ b/library/cpp/getopt/ut/opt_ut.cpp
@@ -24,7 +24,7 @@ Y_UNIT_TEST_SUITE(OptTest) {
int argc = 5;
Opt opts(argc, argv, "", options);
- UNIT_ASSERT_VALUES_EQUAL(JoinStrings(opts.GetFreeArgs(), ", "), "ARG1, ARG3");
+ UNIT_ASSERT_VALUES_EQUAL(JoinStrings(opts.GetFreeArgs(), ", "), "ARG1, ARG3");
}
Y_UNIT_TEST(TestLongOption) {
@@ -37,7 +37,7 @@ Y_UNIT_TEST_SUITE(OptTest) {
int argc = 5;
Opt opts(argc, argv, "", options);
- TString optionValue = "";
+ TString optionValue = "";
int optlet = 0;
while ((optlet = opts.Get()) != EOF) {
if (optlet == SOME_OPTION_ID) {
diff --git a/library/cpp/getopt/ut/posix_getopt_ut.cpp b/library/cpp/getopt/ut/posix_getopt_ut.cpp
index 7a9dbf6c5c..b6d374bf28 100644
--- a/library/cpp/getopt/ut/posix_getopt_ut.cpp
+++ b/library/cpp/getopt/ut/posix_getopt_ut.cpp
@@ -13,9 +13,9 @@ Y_UNIT_TEST_SUITE(TPosixGetoptTest) {
NLastGetopt::optreset = 1;
UNIT_ASSERT_VALUES_EQUAL('b', NLastGetopt::getopt(argc, argv, "bf:"));
UNIT_ASSERT_VALUES_EQUAL('f', NLastGetopt::getopt(argc, argv, "bf:"));
- UNIT_ASSERT_VALUES_EQUAL(NLastGetopt::optarg, TString("1"));
+ UNIT_ASSERT_VALUES_EQUAL(NLastGetopt::optarg, TString("1"));
UNIT_ASSERT_VALUES_EQUAL('f', NLastGetopt::getopt(argc, argv, "bf:"));
- UNIT_ASSERT_VALUES_EQUAL(NLastGetopt::optarg, TString("2"));
+ UNIT_ASSERT_VALUES_EQUAL(NLastGetopt::optarg, TString("2"));
UNIT_ASSERT_VALUES_EQUAL(-1, NLastGetopt::getopt(argc, argv, "bf:"));
UNIT_ASSERT_VALUES_EQUAL(5, NLastGetopt::optind);
diff --git a/library/cpp/getopt/ut/ygetopt_ut.cpp b/library/cpp/getopt/ut/ygetopt_ut.cpp
index 29cfb0e8e3..a76f117216 100644
--- a/library/cpp/getopt/ut/ygetopt_ut.cpp
+++ b/library/cpp/getopt/ut/ygetopt_ut.cpp
@@ -29,8 +29,8 @@ void TGetOptTest::TestGetOpt() {
"-q",
nullptr};
- TString res;
- const TString format = "qzp:f";
+ TString res;
+ const TString format = "qzp:f";
TGetOpt opt(sizeof(argv) / sizeof(*argv) - 1, argv, format);
for (TGetOpt::TIterator it = opt.Begin(); it != opt.End(); ++it) {