| 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}) )"; |
no test coverage detected