oh-my-bash icon indicating copy to clipboard operation
oh-my-bash copied to clipboard

adding t alias conditianal completion

Open TechDufus opened this issue 2 years ago • 3 comments

This PR closes https://github.com/ohmybash/oh-my-bash/issues/379

Since aliases are sourced before completions, we can check for the existence of the alias at this point and conditionally load completion for it here.

TechDufus avatar Dec 12 '22 16:12 TechDufus

Do we need this? If the user would like to reflect the completion settings also to the corresponding aliases, the official way is to set progcomp_alias:

shopt -s progcomp_alias

akinomyoga avatar Dec 12 '22 17:12 akinomyoga

I think you're right.. I'm just having this setting clash with complete -D which is why I'm having issues... This can probably just be dropped...

TechDufus avatar Dec 12 '22 19:12 TechDufus

Thank you for your reply. I now see the problem. I guess this should be fixed at the side of Bash or the default completion function of complete -D -F func.

I checked the mailing list of Bash and found a thread [1] where the discussion seemed to have stopped in the middle, and the change did not happen. I also checked the implementation of bash-completion's __load_completion [2] (which is used by bash-completion's default completion), but it doesn't seem to handle the aliases. There is actually a Bash configuration cykerway/complete-alias [3] to handle aliases, and it is suggested to merge it into bash-completion [4], which haven't yet happened actually. On the other hand, progcomp_alias has a higher priority than the default completion of complete -D in ble.sh [5],

akinomyoga avatar Dec 12 '22 21:12 akinomyoga