diff options
author | hr0nix <hr0nix@yandex-team.ru> | 2022-02-10 16:49:59 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:49:59 +0300 |
commit | ba105fe2a44ef4553a9c1dabc9c632702a59c965 (patch) | |
tree | 5a1c2910a8fdb90aafc4c0eba551a437e57385b1 /library/cpp/getopt/small | |
parent | 042dfdfd1388209ce3aa06dca56bd52ec63d40b2 (diff) | |
download | ydb-ba105fe2a44ef4553a9c1dabc9c632702a59c965.tar.gz |
Restoring authorship annotation for <hr0nix@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/getopt/small')
-rw-r--r-- | library/cpp/getopt/small/modchooser.cpp | 28 | ||||
-rw-r--r-- | library/cpp/getopt/small/modchooser.h | 30 |
2 files changed, 29 insertions, 29 deletions
diff --git a/library/cpp/getopt/small/modchooser.cpp b/library/cpp/getopt/small/modchooser.cpp index 2fa5cfd070..5a4bbea034 100644 --- a/library/cpp/getopt/small/modchooser.cpp +++ b/library/cpp/getopt/small/modchooser.cpp @@ -69,15 +69,15 @@ TModChooser::TMode::TMode(const TString& name, TMainClass* main, const TString& { } -TModChooser::TModChooser() +TModChooser::TModChooser() : ModesHelpOption("-?") // Default help option in last_getopt , VersionHandler(nullptr) , ShowSeparated(true) , SvnRevisionOptionDisabled(false) , PrintShortCommandInUsage(false) -{ -} - +{ +} + TModChooser::~TModChooser() = default; void TModChooser::AddMode(const TString& mode, const TMainFunctionRawPtr func, const TString& description, bool hidden, bool noCompletion) { @@ -133,13 +133,13 @@ void TModChooser::SetDescription(const TString& descr) { } void TModChooser::SetModesHelpOption(const TString& helpOption) { - ModesHelpOption = helpOption; -} - -void TModChooser::SetVersionHandler(TVersionHandlerPtr handler) { - VersionHandler = handler; -} - + ModesHelpOption = helpOption; +} + +void TModChooser::SetVersionHandler(TVersionHandlerPtr handler) { + VersionHandler = handler; +} + void TModChooser::SetSeparatedMode(bool separated) { ShowSeparated = separated; } @@ -185,9 +185,9 @@ int TModChooser::Run(const int argc, const char** argv) const { return 0; } if (VersionHandler && (modeName == "-v" || modeName == "--version")) { - VersionHandler(); - return 0; - } + VersionHandler(); + return 0; + } if (!SvnRevisionOptionDisabled && modeName == "--svnrevision") { NLastGetopt::PrintVersionAndExit(nullptr); } diff --git a/library/cpp/getopt/small/modchooser.h b/library/cpp/getopt/small/modchooser.h index 0a8de6d50b..db323f47ef 100644 --- a/library/cpp/getopt/small/modchooser.h +++ b/library/cpp/getopt/small/modchooser.h @@ -30,9 +30,9 @@ public: virtual ~TMainClass() = default; }; -//! Function to handle '--version' parameter -typedef void (*TVersionHandlerPtr)(); - +//! Function to handle '--version' parameter +typedef void (*TVersionHandlerPtr)(); + /*! Main class for handling different modes in single tool. * * You can add modes for this class, use autogenerated help with @@ -43,7 +43,7 @@ typedef void (*TVersionHandlerPtr)(); */ class TModChooser { public: - TModChooser(); + TModChooser(); ~TModChooser(); public: @@ -67,10 +67,10 @@ public: //! Set modes help option name (-? is by default) void SetModesHelpOption(const TString& helpOption); - - //! Specify handler for '--version' parameter - void SetVersionHandler(TVersionHandlerPtr handler); - + + //! Specify handler for '--version' parameter + void SetVersionHandler(TVersionHandlerPtr handler); + //! Set description show mode void SetSeparatedMode(bool separated = true); @@ -89,9 +89,9 @@ public: * In this method following things happen: * 1) If first argument is -h/--help/-? then print short description of * all modes and exit with zero code. - * 2) If first argument is -v/--version and version handler is specified, + * 2) If first argument is -v/--version and version handler is specified, * then call it and exit with zero code. - * 3) Find mode with the same name as first argument. If it's found then + * 3) Find mode with the same name as first argument. If it's found then * call it and return its return code. * 4) If appropriate mode is not found - return non-zero code. */ @@ -138,19 +138,19 @@ private: //! Main program description. TString Description; - //! Help option for modes. + //! Help option for modes. TString ModesHelpOption; - + //! Wrappers around all modes. TVector<THolder<TMainClass>> Wrappers; //! Modes TMap<TString, TMode*> Modes; - + TString DefaultMode; - //! Handler for '--version' parameter - TVersionHandlerPtr VersionHandler; + //! Handler for '--version' parameter + TVersionHandlerPtr VersionHandler; //! When set to true, show descriptions unsorted and display separators bool ShowSeparated; |