MCPcopy Create free account
hub / github.com/catboost/catboost / Generate

Method Generate

library/cpp/getopt/small/completion_generator.cpp:36–67  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34 }
35
36 void TZshCompletionGenerator::Generate(TStringBuf command, IOutputStream& stream) {
37 TFormattedOutput out;
38 NComp::TCompleterManager manager{command};
39
40 L << "#compdef " << command;
41 L;
42 L << "_" << command << "() {";
43 {
44 I;
45 L << "local state line desc modes context curcontext=\"$curcontext\" ret=1";
46 L << "local words_orig=(\"${words[@]}\")";
47 L << "local current_orig=\"$((CURRENT - 1))\"";
48 L << "local prefix_orig=\"$PREFIX\"";
49 L << "local suffix_orig=\"$SUFFIX\"";
50 L;
51 std::visit(TOverloaded{
52 [&out, &manager](const TModChooser* modChooser) {
53 GenerateModesCompletion(out, *modChooser, manager);
54 },
55 [&out, &manager](const TOpts* opts) {
56 GenerateOptsCompletion(out, *opts, manager);
57 }
58 }, Options_);
59 L;
60 L << "return ret";
61 }
62 L << "}";
63 L;
64 manager.GenerateZsh(out);
65
66 out.Print(stream);
67 }
68
69 void TZshCompletionGenerator::GenerateModesCompletion(TFormattedOutput& out, const TModChooser& chooser, NComp::TCompleterManager& manager) {
70 auto modes = chooser.GetUnsortedModes();

Callers 2

MakeCompletionOptFunction · 0.45
DoRunMethod · 0.45

Calls 3

visitFunction · 0.50
GenerateZshMethod · 0.45
PrintMethod · 0.45

Tested by

no test coverage detected