charmbracelet / wishlist

The SSH directory ✨
MIT License
1.1k stars 24 forks source link

Add support for the Include directive in the SSH config file #262

Closed curio77 closed 8 months ago

curio77 commented 8 months ago

wishlist should support the Include directive in the SSH config file, used to incorporate separately-held SSH configurations (typically, host definitions). Otherwise, hosts defined this way won't be considered and listed in wishlist.

caarlos0 commented 8 months ago

this is already supported...

curio77 commented 8 months ago

Huh? Doesn't work for me. 🤔

Just checked again, nope, neither with full (relative) paths nor with wildcards (e.g., Include config.d/*). This is with the latest version of wishlist installed via go install github.com/charmbracelet/wishlist/cmd/wishlist@latest. I don't see the hosts defined in the separate files in the list presented by wishlist (but they work, of course, with ssh on the command line).

caarlos0 commented 8 months ago

what does the logs say?

can you provide a minimal reproducible example?

I just checked here: it is working, and there are tests enforcing it works. So, if it isn't for you, probably there's something different in your configs...

curio77 commented 8 months ago

Alright…

Trying to do this, I think I've identified the issue. ssh takes the Include directive as relative to the location of the file, i.e., relative paths in ~/.ssh/config are resolved relative to ~/.ssh. wishlist, OTOH, resolves relative to the CWD, hence it works when I run it from the ~/.ssh directory but not otherwise. This explains the observed and reported behavior, and I think that's a bug.

curio77 commented 8 months ago

Addendum: And even so, wildcards don't work, it only works with explicit names, but not with something like config.d/*, even if I run wishlist from ~/.ssh or make the wildcard path absolute.

caarlos0 commented 8 months ago

can you check #263?