Genivia / ugrep

NEW ugrep 7.1: a more powerful, ultra fast, user-friendly, compatible grep. Includes a TUI, Google-like Boolean search with AND/OR/NOT, fuzzy search, hexdumps, searches (nested) archives (zip, 7z, tar, pax, cpio), compressed files (gz, Z, bz2, lzma, xz, lz4, zstd, brotli), pdfs, docs, and more
https://ugrep.com
BSD 3-Clause "New" or "Revised" License
2.66k stars 111 forks source link

Bash autocompletion performance #395

Closed jack6th closed 6 months ago

jack6th commented 6 months ago

ugrep 6.0 on Windows with MSYS2 ugrep is a very useful tool. I often use it with bash autocompletion. I tried on an old laptop. After I input ug --(press double TAB) I need wait more than 3 second to see the output 'Display all 117 possibilities? (y or n)'. And I input ug --no(press double TAB) I also need more than 3 second to see the candidate option list.

While I input awk( or aria2c ) --(press double TAB) I can immediately see the bash autocompletion output. How to make ugrep bash autocompletion faster ?

genivia-inc commented 6 months ago

The "usage" completions are produced from $1 --help where $1 is the command e.g. ug or ugrep, which is then piped through sed to produce proper output. This might slow on old machines. Perhaps caching the output of $1 --help should improve performance. Or pre-generating the output. I'll look into that.