Files
winutil/functions/private/Get-WinUtilEntryToolTip.ps1
Malin FossumandChris Titus b8b81edcdb Show preset JSON key in app, tweak, and feature tooltips (#4995)
* Add Get-WinUtilEntryToolTip helper for preset-key tooltips

* Show preset JSON key in app and tweak tooltips

* Match apps search against preset key for consistency with tweaks

* Limit preset-key tooltips to preset-representable controls

Comboboxes and package-manager radio buttons cannot appear in a preset
file. Update-WinUtilSelections routes a flat list of keys by the
WPFInstall/WPFTweaks/WPFToggle/WPFFeature/WPFAppx prefixes, so a preset
can carry neither a combobox selected value nor a radio group choice;
WingetRadioButton and ChocoRadioButton do not even carry a WPF prefix.
Advertising those control names as preset keys invited users to add keys
that fall through the switch and abort the whole import.

Revert the combobox label and radio button tooltips to the plain
description, and add tests that fail if the key is reattached to a
control the preset importer cannot accept.

* fix: address preset key review feedback

* docs: clarify preset key search scope

---------

Co-authored-by: Chris Titus <contact@christitus.com>
2026-08-19 16:26:11 -05:00

26 lines
702 B
PowerShell

function Get-WinUtilEntryToolTip {
<#
.SYNOPSIS
Builds the tooltip string for an app/tweak/feature entry: its description plus its preset JSON key
.PARAMETER Description
The entry's description from the config JSON. May be null or empty.
.PARAMETER Key
The entry's JSON key as used in preset files (e.g. WPFInstallbrave, WPFTweaksTele).
#>
param(
[Parameter(Mandatory = $false)]
[string]$Description,
[Parameter(Mandatory = $true)]
[string]$Key
)
if ([string]::IsNullOrWhiteSpace($Description)) {
return "Preset key: $Key"
}
return "$Description`n`nPreset key: $Key"
}