-
Notifications
You must be signed in to change notification settings - Fork 383
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Native bash-completion 2 loader using complete -D #1220
Comments
I think the current way is fine. Currently, |
@akinomyoga I don't think this answers my question. I'm looking for a way to use a bash-completion 2 style loader (instead of the old bash-completion 1 style loader, which is what you linked to) to register a "fallback" completer that is called to complete any command that doesn't have a completer set. I know this is possible with bash-completion 1, since that's what argcomplete has relied on for many years. What I don't know is whether there's a way to do this with bash-completion 2, short of using the compatibility mode directory - and if not, I'm looking for opinions from @scop on whether this functionality could be added. |
OK, to directly answer the original question,
No, and even if there was a way, I doubt that that is the right solution. However, it actually depends on what is your true purpose. Within my previous reply, I assumed you wanted an official way to hook into If you want to delay the initialization of the If you just need a way to eagerly load completion settings, you can continue to put a file in
The API for bash-completion 1 style completions will be removed in the future (or some have already been removed), but as far as I see |
Then, again I'd suggest #1220 (comment). We've recently upgraded the internal API for the next version, but we will keep the older v2 API for at least several years or maybe ten years. We haven't discussed at which point we'd bump the major version of Even though we internally updated the API, we still expect the external completions to use the v2 API for now. This is because it is generally hard to match the API version of bash-completion and the external completions if the versions of bash-completion with two different APIs coexist in the market. We decided to first replace the internal API while continuing to provide v2 API, and wait for Nevertheless, if you wish, you can support both v2 and v3 APIs with an appropriate test (e.g.
You don't have to take an action for now. When switching to v3 is prompted, you can just switch from
@scop I think the current situation of |
Thanks. That's helpful.
Agreed, I'm not looking to delay the loading. The motivation for my question was two-fold:
That's great, I'll stick to that for now. |
Sorry about the huuuuuuuuge delay on my part. I agree there's no rush to switch away from the bash_completion.d based approach for now, or for a long time. Then again, regarding our own completion backward compatibility stuff, to me the intention is to eventually remove that. But I have no timeline in mind for that either, as far as I'm concerned, it can stay until it starts to create actual problems. Closing as there is no plan to take any action based on this discussion in the foreseeable future. |
Argcomplete uses
complete -D
to register its loader as a general purpose loader that can match any command name:https://github.com/kislyuk/argcomplete/blob/develop/argcomplete/bash_completion.d/_python-argcomplete#L245
This works fine in bash-completion 1, and in the compatibility mode directory (BASH_COMPLETION_COMPAT_DIR) in bash-completion 2, but not in native mode bash-completion 2 (since the main completion loader,
_comp_load()
, matches commands to completer filenames by name to implement lazy loading, so registering a completer to match any name seems impossible).Is there a way to use the bash-completion 2 lazy loader to register a wildcard completer? I'm worried that if I stick with the bash-completion 1 style completer, it will eventually get deprecated.
Thanks 😄
The text was updated successfully, but these errors were encountered: