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

Add interface for walking whole config #23

Open
docwhat opened this issue Jan 15, 2019 · 2 comments
Open

Add interface for walking whole config #23

docwhat opened this issue Jan 15, 2019 · 2 comments

Comments

@docwhat
Copy link

docwhat commented Jan 15, 2019

There is no easy way to walk through all the Hosts in a config file if it uses Include. You have to basically detect that there is an include and manually load each config (taking wildcards into account) and walk them.

Instead, it would be nice if:

  • Config.Expand() returned a Config with all the includes expanded, which would allow Config.Hosts to show all hosts.
  • A Config.walk(callback Function(host Host)) was added.

My use case is I'm trying to write an ssh-completion script that returns all possible completions for use with shells and fzf.

Ideally, if it was passed a partial string (e.g. ssh-host-lister gith) it would narrow the results down to ones that start with or contain gith.

I have another use case, which is that openssh versions prior to 7.3 do not handle Include. This could be used to flatten multiple configuration files (via Include) into one.

@kevinburke
Copy link
Owner

Ah this is a good idea. Do you want to take a stab at implementing it or is this a feature request only?

@docwhat
Copy link
Author

docwhat commented Jan 15, 2019

I took a run at it from a library consumer point of view.

I’ll see if I can find some time.

Sent with GitHawk

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