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

Function Choice

library/cpp/getopt/small/completer.cpp:133–152  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

131 };
132
133 ICompleterPtr Choice(TVector<TChoice> choices) {
134 auto bash = TStringBuilder() << "COMPREPLY+=( $(compgen -W '";
135 TStringBuf sep = "";
136 for (auto& choice : choices) {
137 bash << sep << B(choice.Choice);
138 sep = " ";
139 }
140 bash << "' -- ${cur}) )";
141
142 auto action = TStringBuilder();
143 action << "((";
144 for (auto& choice: choices) {
145 action << " " << SS(choice.Choice);
146 if (choice.Description) {{
147 action << ":" << SS(choice.Description);
148 }}
149 }
150 action << "))";
151 return MakeSimpleShared<TSimpleCompleter>(bash, action);
152 }
153
154 TString Compgen(TStringBuf flags) {
155 return TStringBuilder() << "COMPREPLY+=( $(compgen " << flags << " -- ${cur}) )";

Callers 3

RegisterOptionsMethod · 0.85
ShellChoiceCompleterFunction · 0.85
TOptClass · 0.85

Calls 2

TStringBuilderClass · 0.50
BClass · 0.50

Tested by

no test coverage detected