From f4b5bf2095d7efd8cb324ad13c02fe5caf2d1d25 Mon Sep 17 00:00:00 2001 From: andrew stalin Date: Fri, 4 Apr 2025 09:29:31 +0700 Subject: [PATCH] =?UTF-8?q?Revert=20"25-1:=20TOptionsParseResult:=20throwi?= =?UTF-8?q?ng=20an=20exception=20in=20case=20of=20options=20p=E2=80=A6"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit dfed0b40f1eaf8956989c06822af3b5cc1ec4266. --- ydb/public/lib/ydb_cli/common/command.cpp | 2 +- ydb/public/lib/ydb_cli/common/command.h | 31 +---------------------- 2 files changed, 2 insertions(+), 31 deletions(-) diff --git a/ydb/public/lib/ydb_cli/common/command.cpp b/ydb/public/lib/ydb_cli/common/command.cpp index 9264850d66ef..c91cb24c3506 100644 --- a/ydb/public/lib/ydb_cli/common/command.cpp +++ b/ydb/public/lib/ydb_cli/common/command.cpp @@ -204,7 +204,7 @@ int TClientCommand::Process(TConfig& config) { } void TClientCommand::SaveParseResult(TConfig& config) { - ParseResult = std::make_shared(config.Opts, config.ArgC, config.ArgV); + ParseResult = std::make_shared(config.Opts, config.ArgC, config.ArgV); } void TClientCommand::Prepare(TConfig& config) { diff --git a/ydb/public/lib/ydb_cli/common/command.h b/ydb/public/lib/ydb_cli/common/command.h index 27ec26864324..d3ea848edfb6 100644 --- a/ydb/public/lib/ydb_cli/common/command.h +++ b/ydb/public/lib/ydb_cli/common/command.h @@ -326,36 +326,7 @@ class TClientCommand { } }; - class TCommandOptsParseResult: public NLastGetopt::TOptsParseResult { - public: - TCommandOptsParseResult(const NLastGetopt::TOpts* options, int argc, const char* argv[]) { - Init(options, argc, argv); - } - TCommandOptsParseResult(const NLastGetopt::TOpts* options, int argc, char* argv[]) { - Init(options, argc, const_cast(argv)); - } - virtual ~TCommandOptsParseResult() = default; - - void HandleError() const override { - if (ThrowOnParseError) { - throw; - } - NLastGetopt::TOptsParseResult::HandleError(); - } - - protected: - TCommandOptsParseResult() = default; - - void Init(const NLastGetopt::TOpts* options, int argc, const char* argv[]) { - ThrowOnParseError = options->HasLongOption("throw-on-parse-error"); - NLastGetopt::TOptsParseResult::Init(options, argc, argv); - } - - private: - bool ThrowOnParseError = false; - }; - - class TOptsParseOneLevelResult : public TCommandOptsParseResult { + class TOptsParseOneLevelResult : public NLastGetopt::TOptsParseResult { public: TOptsParseOneLevelResult(TConfig& config); };