diff options
author | amatanhead <amatanhead@yandex-team.ru> | 2022-02-10 16:50:04 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:50:04 +0300 |
commit | b6f3a80f7c2c8b7dbb0c01b056fdc1fd8cd820e9 (patch) | |
tree | 5d5cb817648f650d76cf1076100726fd9b8448e8 /library/cpp/getopt/small/completion_generator.h | |
parent | 8879605a63ac17539be5b3bd41b529791f4d4b02 (diff) | |
download | ydb-b6f3a80f7c2c8b7dbb0c01b056fdc1fd8cd820e9.tar.gz |
Restoring authorship annotation for <amatanhead@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/getopt/small/completion_generator.h')
-rw-r--r-- | library/cpp/getopt/small/completion_generator.h | 136 |
1 files changed, 68 insertions, 68 deletions
diff --git a/library/cpp/getopt/small/completion_generator.h b/library/cpp/getopt/small/completion_generator.h index ac076e4d90..4241bb7d6c 100644 --- a/library/cpp/getopt/small/completion_generator.h +++ b/library/cpp/getopt/small/completion_generator.h @@ -1,69 +1,69 @@ -#pragma once - -#include "completer.h" -#include "formatted_output.h" -#include "last_getopt_opts.h" -#include "modchooser.h" - -#include <util/generic/variant.h> -#include <util/string/builder.h> - -namespace NLastGetopt { - class TCompletionGenerator { - public: - explicit TCompletionGenerator(const TModChooser* modChooser); - explicit TCompletionGenerator(const TOpts* opts); - virtual ~TCompletionGenerator() = default; - - public: - virtual void Generate(TStringBuf command, IOutputStream& stream) = 0; - - protected: +#pragma once + +#include "completer.h" +#include "formatted_output.h" +#include "last_getopt_opts.h" +#include "modchooser.h" + +#include <util/generic/variant.h> +#include <util/string/builder.h> + +namespace NLastGetopt { + class TCompletionGenerator { + public: + explicit TCompletionGenerator(const TModChooser* modChooser); + explicit TCompletionGenerator(const TOpts* opts); + virtual ~TCompletionGenerator() = default; + + public: + virtual void Generate(TStringBuf command, IOutputStream& stream) = 0; + + protected: std::variant<const TModChooser*, const TOpts*> Options_; - }; - - class TZshCompletionGenerator: public TCompletionGenerator { - public: - using TCompletionGenerator::TCompletionGenerator; - - public: - void Generate(TStringBuf command, IOutputStream& stream) override; - - private: - static void GenerateModesCompletion(TFormattedOutput& out, const TModChooser& chooser, NComp::TCompleterManager& manager); - static void GenerateOptsCompletion(TFormattedOutput& out, const TOpts& opts, NComp::TCompleterManager& manager); - static void GenerateDefaultOptsCompletion(TFormattedOutput& out, NComp::TCompleterManager& manager); - static void GenerateOptCompletion(TFormattedOutput& out, const TOpts& opts, const TOpt& opt, NComp::TCompleterManager& manager); - }; - - class TBashCompletionGenerator: public TCompletionGenerator { - public: - using TCompletionGenerator::TCompletionGenerator; - - public: - void Generate(TStringBuf command, IOutputStream& stream) override; - - private: - static void GenerateModesCompletion(TFormattedOutput& out, const TModChooser& chooser, NComp::TCompleterManager& manager, size_t level); - static void GenerateOptsCompletion(TFormattedOutput& out, const TOpts& opts, NComp::TCompleterManager& manager, size_t level); - static void GenerateDefaultOptsCompletion(TFormattedOutput& out, NComp::TCompleterManager& manager); - }; - - namespace NEscaping { - /// Escape ':', '-', '=', '[', ']' for use in zsh _arguments - TString Q(TStringBuf string); - TString QQ(TStringBuf string); - - /// Escape colons for use in zsh _alternative and _arguments - TString C(TStringBuf string); - TString CC(TStringBuf string); - - /// Simple escape for use in zsh single-quoted strings - TString S(TStringBuf string); - TString SS(TStringBuf string); - - /// Simple escape for use in bash single-quoted strings - TString B(TStringBuf string); - TString BB(TStringBuf string); - } -} + }; + + class TZshCompletionGenerator: public TCompletionGenerator { + public: + using TCompletionGenerator::TCompletionGenerator; + + public: + void Generate(TStringBuf command, IOutputStream& stream) override; + + private: + static void GenerateModesCompletion(TFormattedOutput& out, const TModChooser& chooser, NComp::TCompleterManager& manager); + static void GenerateOptsCompletion(TFormattedOutput& out, const TOpts& opts, NComp::TCompleterManager& manager); + static void GenerateDefaultOptsCompletion(TFormattedOutput& out, NComp::TCompleterManager& manager); + static void GenerateOptCompletion(TFormattedOutput& out, const TOpts& opts, const TOpt& opt, NComp::TCompleterManager& manager); + }; + + class TBashCompletionGenerator: public TCompletionGenerator { + public: + using TCompletionGenerator::TCompletionGenerator; + + public: + void Generate(TStringBuf command, IOutputStream& stream) override; + + private: + static void GenerateModesCompletion(TFormattedOutput& out, const TModChooser& chooser, NComp::TCompleterManager& manager, size_t level); + static void GenerateOptsCompletion(TFormattedOutput& out, const TOpts& opts, NComp::TCompleterManager& manager, size_t level); + static void GenerateDefaultOptsCompletion(TFormattedOutput& out, NComp::TCompleterManager& manager); + }; + + namespace NEscaping { + /// Escape ':', '-', '=', '[', ']' for use in zsh _arguments + TString Q(TStringBuf string); + TString QQ(TStringBuf string); + + /// Escape colons for use in zsh _alternative and _arguments + TString C(TStringBuf string); + TString CC(TStringBuf string); + + /// Simple escape for use in zsh single-quoted strings + TString S(TStringBuf string); + TString SS(TStringBuf string); + + /// Simple escape for use in bash single-quoted strings + TString B(TStringBuf string); + TString BB(TStringBuf string); + } +} |