-
Notifications
You must be signed in to change notification settings - Fork 67
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
Provide a function to easily return Hosts
#60
Comments
The ssh_config does not define a list of "hosts" but a list of host matchers, global options, includes and match blocks. There's no point in getting a "list of hosts". You can have something like:
This will apply |
There is definitely a point: if for no other reason, I want tab-completion for my shell command, like what is available for the ssh command. |
I checked how the ssh completion works: If you have already entered It then scans the config(s) and looks for known_hosts file paths in It also looks for files in the ssh directories called Then, if it was invoked with the Then it tries to complete the hostnames using Finally it falls back to the completion system's internal It doesn't use anything but So, parsing the ssh config is just a small part of the ssh command's hostname completion and even that doesn't do it properly (doesn't follow Includes). If you want to duplicate that, you're better off using the same function in your completion, it's part of the bash_completion package itself, so if the user has bash completion, they also have the I didn't look into how it's done for other shells, but quite often it's done by leveraging the existing bash completion scripts. |
Or I could add a |
Currently we have to manually decode the configuration file:
It'd be nice to have a function like
ssh_config.GetHosts()
. It should defaults toDefaultUserSettings
unless overridden the config path from the parameters.The text was updated successfully, but these errors were encountered: