File tree Expand file tree Collapse file tree 2 files changed +31
-2
lines changed
ydb/public/lib/ydb_cli/common Expand file tree Collapse file tree 2 files changed +31
-2
lines changed Original file line number Diff line number Diff line change @@ -204,7 +204,7 @@ int TClientCommand::Process(TConfig& config) {
204
204
}
205
205
206
206
void TClientCommand::SaveParseResult (TConfig& config) {
207
- ParseResult = std::make_shared<NLastGetopt::TOptsParseResult >(config.Opts , config.ArgC , config.ArgV );
207
+ ParseResult = std::make_shared<TCommandOptsParseResult >(config.Opts , config.ArgC , config.ArgV );
208
208
}
209
209
210
210
void TClientCommand::Prepare (TConfig& config) {
Original file line number Diff line number Diff line change @@ -326,7 +326,36 @@ class TClientCommand {
326
326
}
327
327
};
328
328
329
- class TOptsParseOneLevelResult : public NLastGetopt ::TOptsParseResult {
329
+ class TCommandOptsParseResult : public NLastGetopt ::TOptsParseResult {
330
+ public:
331
+ TCommandOptsParseResult (const NLastGetopt::TOpts* options, int argc, const char * argv[]) {
332
+ Init (options, argc, argv);
333
+ }
334
+ TCommandOptsParseResult (const NLastGetopt::TOpts* options, int argc, char * argv[]) {
335
+ Init (options, argc, const_cast <const char **>(argv));
336
+ }
337
+ virtual ~TCommandOptsParseResult () = default ;
338
+
339
+ void HandleError () const override {
340
+ if (ThrowOnParseError) {
341
+ throw ;
342
+ }
343
+ NLastGetopt::TOptsParseResult::HandleError ();
344
+ }
345
+
346
+ protected:
347
+ TCommandOptsParseResult () = default ;
348
+
349
+ void Init (const NLastGetopt::TOpts* options, int argc, const char * argv[]) {
350
+ ThrowOnParseError = options->HasLongOption (" throw-on-parse-error" );
351
+ NLastGetopt::TOptsParseResult::Init (options, argc, argv);
352
+ }
353
+
354
+ private:
355
+ bool ThrowOnParseError = false ;
356
+ };
357
+
358
+ class TOptsParseOneLevelResult : public TCommandOptsParseResult {
330
359
public:
331
360
TOptsParseOneLevelResult (TConfig& config);
332
361
};
You can’t perform that action at this time.
0 commit comments