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

Context aware completion for ssh command #3424

Merged
merged 11 commits into from
Sep 17, 2023
Merged

Conversation

rebrendov
Copy link
Contributor

@rebrendov rebrendov commented Sep 4, 2023

Solves #3416.

Changes for zsh were tested on ArchLinux machine and changes for bash were tested on ArchLinux and Ubuntu Server machines.

For bash had to copy-paste _fzf_complete call from _fzf_host_completion to _fzf_ssh_completion to make sure that _fzf_ssh_completion_post is called.

@rebrendov
Copy link
Contributor Author

Seems that new logic broke the tests. I'll try to fix it.

@rebrendov rebrendov changed the title Context aware completion for ssh command WIP: Context aware completion for ssh command Sep 4, 2023
@rebrendov rebrendov changed the title WIP: Context aware completion for ssh command Context aware completion for ssh command Sep 4, 2023
@rebrendov rebrendov changed the title Context aware completion for ssh command WIP: Context aware completion for ssh command Sep 4, 2023
@rebrendov rebrendov changed the title WIP: Context aware completion for ssh command Context aware completion for ssh command Sep 4, 2023
@rebrendov
Copy link
Contributor Author

Ok, made sure make docker-test is passing.

shell/completion.bash Outdated Show resolved Hide resolved
@junegunn
Copy link
Owner

junegunn commented Sep 12, 2023

I tried to simplify the code and make both implementations as similar as possible.

  • Prepend the user part to the input so the post function is not required
  • [bash] Remove the reliance on $prefix variable across the functions
  • [bash] Fix the bug where the part after @ is lost. e.g. ssh jg@10**<tab>
  • [zsh] Update telnet completion to receive the same set of hosts as ssh

Let me know what you think.

@junegunn junegunn merged commit edfdcc8 into junegunn:master Sep 17, 2023
5 checks passed
@junegunn
Copy link
Owner

Merged with a test case. Thanks.

@rebrendov
Copy link
Contributor Author

rebrendov commented Sep 17, 2023

Sorry, I forgot to send a comment. The simplified code looks great. Thank you for the useful tool!

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

Successfully merging this pull request may close these issues.

2 participants