feat(completion): support for SSH hosts#195
Conversation
7c036f7 to
2b95fc7
Compare
|
While I do appreciate the time taken for this, it does seem like an awful lot of code to have to introduce that we would have to maintain ourselves, just for SSH config parsing. I'm open to including it for now, but we may want to pivot to a more battle-tested approach later on because I am sure we may run into issues in the future when users with more complex SSH configurations start to use it. Also, FYI there is already precedent to use forked packages here, which I use for |
2b95fc7 to
b7a2904
Compare
|
Ok, you convinced me to create a fork for |
5f0c030 to
9976d3e
Compare
water-sucks
left a comment
There was a problem hiding this comment.
Apologies, this PR slipped through the cracks for me and I took a long time to review it.
Some small changes and a rebase would be appreciated :}
Retrieve the hosts from the hosts file, SSH config files, and SSH known_hosts files. Also add a setting to allow users to disable hosts file completion in case it contains too many hosts.
9976d3e to
e28725d
Compare
|
Applied the feedback and rebased. I also ran |
water-sucks
left a comment
There was a problem hiding this comment.
This works for now!
Appreciate the time you've taken for this.
Retrieve the hosts from the hosts file, SSH config files, and SSH known_hosts files. Also add a setting to allow users to disable hosts file completion in case it contains too many hosts.
The implementation copies
_comp_compgen_known_hosts__implfrom bash-completion as much as possible. But some parts are intentionally left out, e.g.ssh2config paths,avahi-browse,ruptime. I believe it also improves upon the ssh config parsing since the lists of hosts fromnixos-cliis more correct, at least on my system.I would use the ssh_config pkg but I'm not sure how to recursively get all hosts, due to some unexported fields. It's probably why a PR was made to add a GetHosts function. So instead of using a fork I have implemented partial ssh config parsing, which has been very fun.
Closes #186.