diff options
Diffstat (limited to 'library/cpp/getopt/small/completion_generator.cpp')
| -rw-r--r-- | library/cpp/getopt/small/completion_generator.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/library/cpp/getopt/small/completion_generator.cpp b/library/cpp/getopt/small/completion_generator.cpp index d893afb40a9..5e0e55ed38b 100644 --- a/library/cpp/getopt/small/completion_generator.cpp +++ b/library/cpp/getopt/small/completion_generator.cpp @@ -63,6 +63,14 @@ namespace NLastGetopt { L; manager.GenerateZsh(out); + // When the completion file is autoloaded by `compinit` from `$fpath`, + // zsh treats the file content as the body of function `_<command>`. + // On first invocation that body merely (re)defines `_<command>` and + // its helpers, so completion would not actually run until the second + // TAB. Calling the redefined function here makes it work on the very + // first TAB and is also harmless when the script is `source`d. + L << "_" << command << " \"$@\""; + out.Print(stream); } |
