aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/getopt/small/last_getopt_opt.h
diff options
context:
space:
mode:
authorbulatkhr <bulatkhr@yandex-team.com>2022-07-15 10:12:22 +0300
committerbulatkhr <bulatkhr@yandex-team.com>2022-07-15 10:12:22 +0300
commit03cf908feb326c966c4384fde4360f08d9b5b4e1 (patch)
tree29faaf859522f25ba29220000dac674ac364569a /library/cpp/getopt/small/last_getopt_opt.h
parentb63fb26957f120f5cbf2a363d9fef60df2e7c2ae (diff)
downloadydb-03cf908feb326c966c4384fde4360f08d9b5b4e1.tar.gz
Allow skip arg in opt parser
add UnnecessaryArgument
Diffstat (limited to 'library/cpp/getopt/small/last_getopt_opt.h')
-rw-r--r--library/cpp/getopt/small/last_getopt_opt.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/library/cpp/getopt/small/last_getopt_opt.h b/library/cpp/getopt/small/last_getopt_opt.h
index a8dd5adca9..e8567bd4f6 100644
--- a/library/cpp/getopt/small/last_getopt_opt.h
+++ b/library/cpp/getopt/small/last_getopt_opt.h
@@ -62,6 +62,7 @@ namespace NLastGetopt {
EHasArg HasArg_ = DEFAULT_HAS_ARG; // the argument parsing politics
bool Required_ = false; // option existence politics
+ bool EqParseOnly_ = false; // allows option not to read argument
bool AllowMultipleCompletion_ = false; // let the completer know that this option can occur more than once
@@ -286,6 +287,23 @@ namespace NLastGetopt {
}
/**
+ * allow only --option=arg parsing and disable --option arg
+ * @return self
+ */
+ TOpt& DisableSpaceParse() {
+ Y_ASSERT(GetHasArg() == OPTIONAL_ARGUMENT);
+ EqParseOnly_ = true;
+ return *this;
+ }
+
+ /**
+ * @return true if only --option=arg parse allowed
+ */
+ bool IsEqParseOnly() const {
+ return EqParseOnly_;
+ }
+
+ /**
* sets the option to be optional
* @return self
*/