Skip to content
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

progcomp_alias bash option does not work due to 'complete -F _completion_loader -D' #383

Open
bubbleguuum opened this issue Jan 20, 2020 · 4 comments

Comments

@bubbleguuum
Copy link

bubbleguuum commented Jan 20, 2020

Programmable completion on expanded aliases (shopt +s progcomp_alias) does not work when there is a 'complete -D' rule. I would be nice to have this working. this would for example allow this scenario to work:

shopt +s progcomp_alias
alias ss='systemctl start'
ss <TAB>
<shows completion for 'systemctl start'  (that is: a list of services), instead of regular file completion>

Also see: https://lists.gnu.org/archive/html/bug-bash/2019-01/msg00101.html

@scop
Copy link
Owner

scop commented Jan 20, 2020

If you prefer to work without dynamic completion loading, I suppose you could do a complete -r -D after bash_completion has been loaded to get rid of it. Then perhaps load the desired completions you want to be available by manually/explicitly sourcing them from the completions dir.

Even though it's of less importance nowadays with disks being a lot faster than they used to be, I still think that dynamic loading is a pretty essential thing to have, and don't think it would be time to let go of that in the default project config here.

Can you think of a way we could make things better for the mentioned use case without sacrificing dynamic loading?

@bubbleguuum
Copy link
Author

I'm not familiar with _completion_loader and how it works but I wondered if would be possible to have an operating mode where all the dynamic completions would be preemptively loaded, thus not needing the complete -D rule ?

@scop
Copy link
Owner

scop commented Jan 21, 2020

I'd rather not encourage that way or spend time on it. And on the other hand, I don't think we can make it much more compact for users to use than what's currently already possible (I presume, untested):

complete -r -D
for f in $(pkg-config --variable=completionsdir bash-completion); do . $f; done
# or use direct hardcoded path if you like, or cat everything and source /dev/stdin or ...

@bubbleguuum
Copy link
Author

bubbleguuum commented Jan 21, 2020

Confirming that it works, though it takes around 1.5s loading about 950 completions (files) on a fast machine. So inefficient and not really a good idea. A more realistic solution is to complete -r -D then selectively load completions that I actually use.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants