[PR #11390] [MERGED] Implement basic profile matching #28544

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

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/11390
Author: @lhecker
Created: 10/1/2021
Status: Merged
Merged: 10/8/2021
Merged by: @undefined

Base: mainHead: dev/lhecker/profile-matching


📝 Commits (9)

  • 4642ccf Implement basic profile matching
  • 91f1cf1 Added fallback to _normalizeCommandLine for UWP
  • 4176523 Satisfy linter
  • 2f297f6 Ignore Azure profiles
  • 7a43afb Merge remote-tracking branch 'origin/main' into dev/lhecker/profile-matching
  • ca7008d An assortment of changes
  • b0f076e Fix spelling lists
  • 6dd59bf Fix build error & Address Mike's comments
  • 0d7c462 Unload cryptbase on binary exit

📊 Changes

21 files changed (+809 additions, -73 deletions)

View changed files

📝 .github/actions/spelling/allow/microsoft.txt (+3 -0)
📝 .github/actions/spelling/expect/expect.txt (+6 -0)
oss/pcg/LICENSE-APACHE.txt (+201 -0)
oss/pcg/LICENSE-MIT.txt (+19 -0)
oss/pcg/cgmanifest.json (+14 -0)
oss/pcg/include/pcg_random.hpp (+82 -0)
📝 src/cascadia/LocalTests_SettingsModel/TerminalSettingsTests.cpp (+137 -4)
📝 src/cascadia/TerminalApp/TerminalPage.cpp (+18 -30)
📝 src/cascadia/TerminalApp/TerminalPage.h (+1 -1)
📝 src/cascadia/TerminalConnection/ConptyConnection.cpp (+47 -17)
📝 src/cascadia/TerminalConnection/ConptyConnection.h (+4 -2)
📝 src/cascadia/TerminalConnection/ConptyConnection.idl (+3 -0)
📝 src/cascadia/TerminalConnection/ITerminalConnection.idl (+0 -2)
📝 src/cascadia/TerminalSettingsModel/CascadiaSettings.cpp (+209 -2)
📝 src/cascadia/TerminalSettingsModel/CascadiaSettings.h (+6 -0)
📝 src/cascadia/TerminalSettingsModel/WslDistroGenerator.cpp (+5 -7)
📝 src/common.build.pre.props (+1 -1)
📝 src/host/ntprivapi.cpp (+1 -3)
📝 src/host/ntprivapi.hpp (+4 -3)
📝 src/host/srvinit.cpp (+1 -1)

...and 1 more files

📄 Description

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

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/microsoft/terminal/pull/11390 **Author:** [@lhecker](https://github.com/lhecker) **Created:** 10/1/2021 **Status:** ✅ Merged **Merged:** 10/8/2021 **Merged by:** [@undefined](undefined) **Base:** `main` ← **Head:** `dev/lhecker/profile-matching` --- ### 📝 Commits (9) - [`4642ccf`](https://github.com/microsoft/terminal/commit/4642ccfa155c23e3d5843467e92b0957f5adf28e) Implement basic profile matching - [`91f1cf1`](https://github.com/microsoft/terminal/commit/91f1cf1eb39beb4e90d9b133ff3249adce636d81) Added fallback to _normalizeCommandLine for UWP - [`4176523`](https://github.com/microsoft/terminal/commit/4176523139988aebb6c1aa68e9d68feeb0e22747) Satisfy linter - [`2f297f6`](https://github.com/microsoft/terminal/commit/2f297f6466e3a9de456181b344620bbb7da76cc7) Ignore Azure profiles - [`7a43afb`](https://github.com/microsoft/terminal/commit/7a43afb59c4307fc59fab8e26a5c77dd6ae920d6) Merge remote-tracking branch 'origin/main' into dev/lhecker/profile-matching - [`ca7008d`](https://github.com/microsoft/terminal/commit/ca7008d5ad4007b1e5b4951aea0890c35f99aa4b) An assortment of changes - [`b0f076e`](https://github.com/microsoft/terminal/commit/b0f076ec2c57c5226a82a93af1486db3769a73b9) Fix spelling lists - [`6dd59bf`](https://github.com/microsoft/terminal/commit/6dd59bf5e4cbc9c6022e81cee6d9d0ee9b1c8112) Fix build error & Address Mike's comments - [`0d7c462`](https://github.com/microsoft/terminal/commit/0d7c462b585dafc95f84cfc415dcb2f03ad656c7) Unload cryptbase on binary exit ### 📊 Changes **21 files changed** (+809 additions, -73 deletions) <details> <summary>View changed files</summary> 📝 `.github/actions/spelling/allow/microsoft.txt` (+3 -0) 📝 `.github/actions/spelling/expect/expect.txt` (+6 -0) ➕ `oss/pcg/LICENSE-APACHE.txt` (+201 -0) ➕ `oss/pcg/LICENSE-MIT.txt` (+19 -0) ➕ `oss/pcg/cgmanifest.json` (+14 -0) ➕ `oss/pcg/include/pcg_random.hpp` (+82 -0) 📝 `src/cascadia/LocalTests_SettingsModel/TerminalSettingsTests.cpp` (+137 -4) 📝 `src/cascadia/TerminalApp/TerminalPage.cpp` (+18 -30) 📝 `src/cascadia/TerminalApp/TerminalPage.h` (+1 -1) 📝 `src/cascadia/TerminalConnection/ConptyConnection.cpp` (+47 -17) 📝 `src/cascadia/TerminalConnection/ConptyConnection.h` (+4 -2) 📝 `src/cascadia/TerminalConnection/ConptyConnection.idl` (+3 -0) 📝 `src/cascadia/TerminalConnection/ITerminalConnection.idl` (+0 -2) 📝 `src/cascadia/TerminalSettingsModel/CascadiaSettings.cpp` (+209 -2) 📝 `src/cascadia/TerminalSettingsModel/CascadiaSettings.h` (+6 -0) 📝 `src/cascadia/TerminalSettingsModel/WslDistroGenerator.cpp` (+5 -7) 📝 `src/common.build.pre.props` (+1 -1) 📝 `src/host/ntprivapi.cpp` (+1 -3) 📝 `src/host/ntprivapi.hpp` (+4 -3) 📝 `src/host/srvinit.cpp` (+1 -1) _...and 1 more files_ </details> ### 📄 Description 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 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-31 09:29:13 +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#28544