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

Does this still work? #42

Open
sdondley opened this issue Dec 29, 2022 · 5 comments
Open

Does this still work? #42

sdondley opened this issue Dec 29, 2022 · 5 comments

Comments

@sdondley
Copy link
Contributor

sdondley commented Dec 29, 2022

The instructions are confusing or I'm too dumb to figure them out or this doesn't work on Debian bullseye anymore running bash 5.1.4. I installed this with apt get bash-completion

I have an alias for docker called "dk".

I created file in home directory called complate_alias with following:

complete -F _complete_alias dk

In a newly created file called .bash_completion in my home dir, I have . /home/admin/complete_alias. I also put the same in ~/.bashrc.

I logged out and back into the shell. Resource all the files above. Still get:

dk <tab>-bash: completion: function _complete_alias' not found`

@sdondley
Copy link
Contributor Author

Ok, I manually ran the following commands:

complete -F _complete_alias dk
complete -F _docker dk

And things started to work. I'm not entirely sure why, though.

@sdondley
Copy link
Contributor Author

One thing I'm noticing is that completion does not work with the alias until a completion has been run using the full command name at least once. 🤷🏽‍♂️

@willpower232
Copy link

I don't have anything else in ~/.bash_completion so I just saved the complete_alias file as ~/.bash_completion

Also I have this note in my /etc/bash.bashrc which may or may not be relevant

# Debian doesn't have bash-completion by default so you need to apt install bash-completion and add the below
# also don't forget about https://github.com/cykerway/complete-alias
if [ -f /etc/bash_completion ]; then
    . /etc/bash_completion
fi

@comely
Copy link

comely commented Mar 2, 2023

One thing I'm noticing is that completion does not work with the alias until a completion has been run using the full command name at least once. 🤷🏽‍♂️

for my use-case i do not need complete-alias, however i had this issue also & resolve it by writing

_completion_loader $program_name
complete -F _$program_name $alias_name

the completion function may be something other than _$program_name depending on what it is. also, this works with anything, it is not limited to aliases

@flokain
Copy link

flokain commented Mar 3, 2023

I created file in home directory called complate_alias with following:

complete -F _complete_alias dk

i made the same mistake. you need to COPY the complete_alias file from the repo an APPEND your completion command to it. the example in the read me walks you through it.

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

4 participants