aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/getopt/small
diff options
context:
space:
mode:
authoryuraaka <yuraaka@yandex-team.ru>2022-02-10 16:47:05 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:47:05 +0300
commit5577dc406121f6fb3f45b227c01f4251880193a1 (patch)
treeb83306b6e37edeea782e9eed673d89286c4fef35 /library/cpp/getopt/small
parent4230543261d7a38ef4dc14785ae0d45f2da43704 (diff)
downloadydb-5577dc406121f6fb3f45b227c01f4251880193a1.tar.gz
Restoring authorship annotation for <yuraaka@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/getopt/small')
-rw-r--r--library/cpp/getopt/small/last_getopt_opts.h38
-rw-r--r--library/cpp/getopt/small/last_getopt_parse_result.cpp20
2 files changed, 29 insertions, 29 deletions
diff --git a/library/cpp/getopt/small/last_getopt_opts.h b/library/cpp/getopt/small/last_getopt_opts.h
index 1361ad6731..825b99c871 100644
--- a/library/cpp/getopt/small/last_getopt_opts.h
+++ b/library/cpp/getopt/small/last_getopt_opts.h
@@ -43,7 +43,7 @@ namespace NLastGetopt {
typedef TVector<TSimpleSharedPtr<TOpt>> TOptsVector;
TOptsVector Opts_; // infomation about named (short and long) options
- TVector<std::function<void(TStringBuf)>> ArgBindings_;
+ TVector<std::function<void(TStringBuf)>> ArgBindings_;
EArgPermutation ArgPermutation_ = DEFAULT_ARG_PERMUTATION; // determines how to parse positions of named and free options. See information below.
bool AllowSingleDashForLong_ = false; //
@@ -245,22 +245,22 @@ namespace NLastGetopt {
TOpt& AddOption(const TOpt& option);
/**
- * Creates new free argument handling
- * @param name name of free arg to show in help
- * @param target variable address to store parsing result into
- * @param help help string to show in help
- */
- template <typename T>
- void AddFreeArgBinding(const TString& name, T& target, const TString& help = "") {
- ArgBindings_.emplace_back([&target](TStringBuf value) {
- target = FromString<T>(value);
- });
-
- FreeArgsMax_ = Max<ui32>(FreeArgsMax_, ArgBindings_.size());
- SetFreeArgTitle(ArgBindings_.size() - 1, name, help);
- }
-
- /**
+ * Creates new free argument handling
+ * @param name name of free arg to show in help
+ * @param target variable address to store parsing result into
+ * @param help help string to show in help
+ */
+ template <typename T>
+ void AddFreeArgBinding(const TString& name, T& target, const TString& help = "") {
+ ArgBindings_.emplace_back([&target](TStringBuf value) {
+ target = FromString<T>(value);
+ });
+
+ FreeArgsMax_ = Max<ui32>(FreeArgsMax_, ArgBindings_.size());
+ SetFreeArgTitle(ArgBindings_.size() - 1, name, help);
+ }
+
+ /**
* Creates options list from string as in getopt(3)
*
* @param optstring source
@@ -460,11 +460,11 @@ namespace NLastGetopt {
/**
* Set maximal number of free args
*
- * @param max new value
+ * @param max new value
*/
void SetFreeArgsMax(size_t max) {
FreeArgsMax_ = ui32(max);
- FreeArgsMax_ = Max<ui32>(FreeArgsMax_, ArgBindings_.size());
+ FreeArgsMax_ = Max<ui32>(FreeArgsMax_, ArgBindings_.size());
}
/**
diff --git a/library/cpp/getopt/small/last_getopt_parse_result.cpp b/library/cpp/getopt/small/last_getopt_parse_result.cpp
index d7230c2592..f4b5607a90 100644
--- a/library/cpp/getopt/small/last_getopt_parse_result.cpp
+++ b/library/cpp/getopt/small/last_getopt_parse_result.cpp
@@ -126,16 +126,16 @@ namespace NLastGetopt {
TOptParseResult& r = OptParseResult();
r.AddValue(Parser_->CurValOrOpt().data());
}
-
- Y_ENSURE(options);
- const auto freeArgs = GetFreeArgs();
- for (size_t i = 0; i < freeArgs.size(); ++i) {
- if (i >= options->ArgBindings_.size()) {
- break;
- }
-
- options->ArgBindings_[i](freeArgs[i]);
- }
+
+ Y_ENSURE(options);
+ const auto freeArgs = GetFreeArgs();
+ for (size_t i = 0; i < freeArgs.size(); ++i) {
+ if (i >= options->ArgBindings_.size()) {
+ break;
+ }
+
+ options->ArgBindings_[i](freeArgs[i]);
+ }
} catch (...) {
HandleError();
}