[PR #11390] Implement basic profile matching #28549

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

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

State: closed
Merged: Yes


This implements command line matching for CascadiaSettings::GetProfileForArgs.
The command lines for all user profiles are resolved to absolute file paths,
argument quotes are standardized ("canonicalized") and the results are cached.

When GetProfileForArgs is called with a Commandline() value, we "canonicalize"
the argument as well and find the profile that is the longest prefix.
If none could be found the default profile is returned.

PR Checklist

Validation Steps Performed

  • Open a cmd.exe tab in the store-version of WT
  • Run start cmd
    --> A tab with the cmd.exe profile opens
  • Run start pwsh.exe
    --> A tab with the PowerShell 7 profile opens
  • Run PowerShell 7 from the start menu
    --> A tab with the PowerShell 7 profile opens
  • Create a symlink for PowerShell 7 and launch pwsh.exe from there
    --> A tab with the PowerShell 7 profile opens
**Original Pull Request:** https://github.com/microsoft/terminal/pull/11390 **State:** closed **Merged:** Yes --- This implements command line matching for `CascadiaSettings::GetProfileForArgs`. The command lines for all user profiles are resolved to absolute file paths, argument quotes are standardized ("canonicalized") and the results are cached. When `GetProfileForArgs` is called with a Commandline() value, we "canonicalize" the argument as well and find the profile that is the longest prefix. If none could be found the default profile is returned. ## PR Checklist * [x] Closes #9458 * [x] Closes #10952 * [x] I work here * [ ] Tests added/passed ## Validation Steps Performed * Open a `cmd.exe` tab in the store-version of WT * Run `start cmd` --> A tab with the `cmd.exe` profile opens * Run `start pwsh.exe` --> A tab with the PowerShell 7 profile opens * Run PowerShell 7 from the start menu --> A tab with the PowerShell 7 profile opens * Create a symlink for PowerShell 7 and launch `pwsh.exe` from there --> A tab with the PowerShell 7 profile opens
claunia added the pull-request label 2026-01-31 09:29:14 +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#28549