feat: correctly include hosts from nested SSH Include - #47
Merged
Conversation
…files Normalize Include parsing and preserve multiline config flow when building completion candidates. Add visited-file tracking to avoid infinite recursion on cyclic includes.
Use an actual newline when combining the fzf header and host list so aliases no longer get a literal "\\n" prefix in completion output.
…ssions Reset parser globals when state is inconsistent and always clean up recursion tracking. This prevents empty completion output after interrupted include parsing.
Normalize literal `~` prefixes before resolving relative include paths so hosts from configs like `~/.ssh/config.d/*.ssh_config` are included in fzf completion. Made-with: Cursor
Owner
|
@ergoz Thank you. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR improves SSH host completion so entries from
Include-d config files are reliably included in suggestions, not just hosts from the main config file.What changed
zsh-ssh.zshparser to handleIncludedirectives more robustly:Include~, relative paths, absolute paths, and glob expansionecho $varusage withprintf "%s\n" "$var"in key placesREADME.mdwith a concrete multi-fileIncludeexample (~/.ssh/config.d/*.ssh_configstyle)Why this change
In some real-world setups, host definitions live in multiple files included from
~/.ssh/config. Completion was expected to include those hosts but could miss them in edge cases (or fail on recursive include loops). This PR aligns completion behavior with typical OpenSSH multi-file config layouts.Validation
zsh -n zsh-ssh.zshIncludelines~/.ssh/config.d/*.ssh_config_ssh_host_listoutputExample include layout validated
Notes
README.mdare pre-existing and unrelated to this PR.Also maybe fixes: