[PR #19761] Add support for Include directive in SSH config parser (#19555) #31956

Open
opened 2026-01-31 09:50:36 +00:00 by claunia · 0 comments
Owner

Original Pull Request: https://github.com/microsoft/terminal/pull/19761

State: open
Merged: No


Summary of the Pull Request

Adds support for the Include directive in SSH config parser, enabling Terminal to generate profiles from split SSH configuration files (e.g., Include config.d/*).

References and Relevant Issues

Fixes #19555

Detailed Description of the Pull Request / Additional comments

This PR implements SSH config Include directive support with the following features:

Changes:

  • Added Include directive parsing in SshHostGenerator::_getHostNamesFromConfigFile()
  • Implemented _processIncludeDirective() to handle file inclusion with wildcard pattern support
  • Added _matchesPattern() for wildcard matching (* and ? patterns)
  • Recursively processes included config files relative to the parent config directory

Behavior:

  • Supports direct includes: Include ~/.ssh/config.d/work
  • Supports wildcard includes: Include config.d/*
  • Handles relative paths from config file location
  • Maintains backward compatibility with existing configs

Implementation:

  • Modified: SshHostGenerator.cpp (+107 lines)
  • Modified: SshHostGenerator.h (+2 function declarations)

Validation Steps Performed

  • Tested with direct file includes
  • Tested with wildcard patterns (config.d/*)
  • Verified recursive parsing of included files
  • Confirmed profiles generated correctly from split configs

PR Checklist

**Original Pull Request:** https://github.com/microsoft/terminal/pull/19761 **State:** open **Merged:** No --- ## Summary of the Pull Request Adds support for the `Include` directive in SSH config parser, enabling Terminal to generate profiles from split SSH configuration files (e.g., `Include config.d/*`). ## References and Relevant Issues Fixes #19555 ## Detailed Description of the Pull Request / Additional comments This PR implements SSH config `Include` directive support with the following features: **Changes:** - Added `Include` directive parsing in `SshHostGenerator::_getHostNamesFromConfigFile()` - Implemented `_processIncludeDirective()` to handle file inclusion with wildcard pattern support - Added `_matchesPattern()` for wildcard matching (`*` and `?` patterns) - Recursively processes included config files relative to the parent config directory **Behavior:** - Supports direct includes: `Include ~/.ssh/config.d/work` - Supports wildcard includes: `Include config.d/*` - Handles relative paths from config file location - Maintains backward compatibility with existing configs **Implementation:** - Modified: `SshHostGenerator.cpp` (+107 lines) - Modified: `SshHostGenerator.h` (+2 function declarations) ## Validation Steps Performed - Tested with direct file includes - Tested with wildcard patterns (`config.d/*`) - Verified recursive parsing of included files - Confirmed profiles generated correctly from split configs ## PR Checklist - [x] Closes #19555 - [ ] Tests added/passed - [ ] Documentation updated - [ ] Schema updated (if necessary)
claunia added the pull-request label 2026-01-31 09:50:36 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#31956