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

Case-sensitive ssh completion #644

Open
jornodberg opened this issue Dec 12, 2024 · 4 comments
Open

Case-sensitive ssh completion #644

jornodberg opened this issue Dec 12, 2024 · 4 comments

Comments

@jornodberg
Copy link
Contributor

I had trouble getting ssh-completion to work with hosts defined in .ssh/config

Until I changed the syntax from 'host myhost' to 'Host myhost'.

Why is it case-sensitive, when ssh-config is not?

@akinomyoga
Copy link
Contributor

akinomyoga commented Dec 12, 2024

Because the ssh completion shipped with Oh My Bash is not perfect.

COMPREPLY+=($(compgen -W "$(awk '/^Host/ {for (i=2; i<=NF; i++) print $i}' "${config_files[@]}")" "${options[@]}"))

Actually, there are many places to improve our ssh completion. Probably you want to consider using the completion setting for ssh from the bash-completion project.

@akinomyoga
Copy link
Contributor

If you already have bash-completion installed in your system (specifically at /usr/share/bash-completion/bash_completion), you can simply remove ssh from the array completions in your ~/.bashrc. Then, the ssh completion from the bash-completion project would be usually enabled automatically. If your bash-completion is not installed at /usr/share/bash-completion/bash_completion, you can manually source /path/to/bash-completion in your ~/.bashrc.

@jornodberg
Copy link
Contributor Author

Thanks.

I've edited the code in ssh.completion.sh to allow different cases for 'host': #645

Never really contributed code by Git earlier, so please tell if I've done this incorrect. :)
Or also if my code is shait.

@akinomyoga
Copy link
Contributor

Never really contributed code by Git earlier, so please tell if I've done this incorrect. :) Or also if my code is shait.

Don't worry. You are on the right path.

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