cyjake / ssh-config

📟 SSH config parser and stringifier
MIT License
80 stars 20 forks source link

Parse Include statement at end of file #42

Closed roblourens closed 3 years ago

roblourens commented 3 years ago

Include otherfile is handled correctly at the beginning of the file, but when it appears after another config, it gets added to that config. Example

Host someHost
    HostName 123.123.123.123

Include config3

Parses like this image

cyjake commented 3 years ago

It's intended behavior. According to ssh_config(5), Include might appear inside Match or Host to perform conditional config inclusion.

Include the specified configuration file(s). Multiple pathnames may be specified and each pathname may contain glob(7) wildcards and, for user configurations, shell-like `~' references to user home directories. Files without absolute paths are assumed to be in ~/.ssh if included in a user configuration file or /etc/ssh if included from the system configuration file. Include directive may appear inside a Match or Host block to perform conditional inclusion.

roblourens commented 3 years ago

Oh, you're right. Confirmed that ssh handles it this way. I think I used to know that.