Replies: 1 comment 2 replies
-
On the general topic of such completion generators, it's quite common for projects to have a command that queries the internal data structures of the current binary and then generates a freestanding completion script which doesn't call into the original binary but uses the standard shell completion facilities. It's essentially just a "better way to maintain complex completion scripts". There is a significant advantage to pregenerating the completion script. You don't have to fork+exec into the program every time you hit On the other hand, if you know the application in question, you know the startup time is cheap, and you know there are nearly a thousand options and you know writing out a bash table of a thousand options results in huge chunky data files that maybe bloat your interactive shell memory since they can't be unloaded... then querying the program may indeed make a whole lot more sense as all that data is transient. In terms of practical concerns, many programs that distribute any sort of generated completion script at all are unable to do so when building the software via cross-compilation, as you may not actually be able to run the built program without setting up qemu. But that can be solved by checking for / demanding meson's existing exe_wrapper support -- we anyways sometimes need this for stuff like code generators, gobject-introspection, |
Beta Was this translation helpful? Give feedback.
-
I was looking at clang's code recently and stumbled upon their neat bash auto-completion support. Its functionality is well summarised by this blog post. The key functionality is that clang itself gained a special
--autocomplete
argument which internally causes clang to walk over its programmatically constructed argument table and print the possible valid completions tostdout
. The bash auto-complete script then invokes clang with this special argument and parsesstdout
making it compatible with bash's completion. This has two main advantages:I proposed to the GNOME community that similar functionality be added to glib's
GOptionContext
and the idea was well received. Its implementation is under way.Part of my proposal to GNOME was that meson would gain functionality to help users automatically generate and install a basic shell completion script for a given target. So before the implementation in glib gets too far ahead, I wanted to run the meson part of this by the meson community and get feedback here. I am imagining something like this:
So, meson community, what do you think? Is this idea sensible? Can you see any pitfalls or hidden complexity?
Beta Was this translation helpful? Give feedback.
All reactions