commit 8691cb362c63a970aec3a975c1c6be49a19311dc parent 19b3b5ee94ea4fbb04691e7e45935fcbfb1b17b1 Author: Ryan Yates <ryan.yates@kilasuit.org> Date: Mon, 9 Sep 2024 21:21:16 +0100 Updates to the PowerShell modules (#4716) Diffstat:
54 files changed, 878 insertions(+), 792 deletions(-)
diff --git a/.github/actions/spelling/expect.txt b/.github/actions/spelling/expect.txt @@ -45,6 +45,8 @@ ATL AType AUrl auxdata +awgpm +awgs azcopy azurewebsites Baz @@ -85,7 +87,10 @@ CLASSNOTREG CLOSEAPP cloudapp clsctx +clsid +cmpwgc CMSG +cnwgc cobertura CODEOWNERS codepage @@ -110,6 +115,7 @@ createmanifestmetadata cswinrt ctc CTL +ctwgcy currentuser dacl datetimeoffset @@ -134,6 +140,7 @@ dsc DUPLICATEALIAS dustojnikhummer dvinns +dwgs ecfr ecfrbrowse EFGH @@ -148,10 +155,13 @@ errstr ESRB etest etl +ewgp +ewgs execustom EXEHASH experimentalfeatures fdw +fdwgp FECAFEB fedorapeople fileinuse @@ -188,6 +198,13 @@ GRPICONDIR GRPICONDIRENTRY guiddef Gumbalapura +gwgc +gwgcd +gwgp +gwgse +gwgso +gwgus +gwgv Hackathon hashtables helplib @@ -233,8 +250,10 @@ isable ishelp ISQ ISVs +iswgp itr iwr +iwgc JArray JDictionary jdk @@ -354,6 +373,7 @@ NOSEPARATOR notalostreference NOTAPROPERTY NOTIMPL +notmatch NOTRACK NOUPDATE nowarn @@ -456,19 +476,25 @@ ronomon Roronoa rosoft rowid +rowids roy +rpwgpm RRF rrr +rswgs RTTI runspace runtimeclass runtimes +rwgch +rwgs ryfu sacl SARL sas SASURL savepoint +sawgc schematab Scm sddl @@ -503,6 +529,7 @@ SOURCESDIRECTORY sourceversion spamming SPAPI +spwgc sqlite Srinivasan SRL @@ -518,6 +545,7 @@ subkey Sudarshan superstring swervy +swgus SYD SYG sysrefcomp @@ -527,6 +555,8 @@ TARG taskhostw tcs TEMPDIRECTORY +templating +Templating temppath testexampleinstaller thiscouldbeapc @@ -537,11 +567,15 @@ tombstoned transitioning trimstart ttl +twgc +twgus typedef +typeparam UCase ucasemap UChars ucnv +udwgp uec ULONGLONG UNAVAIL @@ -564,6 +598,7 @@ URLZONE USEDEFAULT userfilesetting userprofile +uswgp uwp VALUENAMECASE vclib @@ -578,6 +613,7 @@ WDAG webpages Webserver website +websites wesome wfsopen wgetenv diff --git a/.github/actions/spelling/patterns.txt b/.github/actions/spelling/patterns.txt @@ -201,3 +201,6 @@ ReplaceWhileCopying\(L.*\) # devil fruits \s([A-Z]{3,}|[A-Z][a-z]{2,}|[a-z]{3,})\s\g{-1}\sno Mi + +# PowerShell Aliases defined in .cs files (not those in AliasesToExport in psd1 files) +\[Alias\("[a-z]+"\)\] diff --git a/src/PowerShell/Help/Microsoft.WinGet.Client/Disable-WinGetSetting.md b/src/PowerShell/Help/Microsoft.WinGet.Client/Disable-WinGetSetting.md @@ -81,6 +81,6 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## RELATED LINKS -[Get-WinGetSettings](Get-WinGetSettings.md) +[Get-WinGetSetting](Get-WinGetSetting.md) -[Set-WinGetUserSettings](Set-WinGetUserSettings.md) +[Set-WinGetUserSetting](Set-WinGetUserSetting.md) diff --git a/src/PowerShell/Help/Microsoft.WinGet.Client/Enable-WinGetSetting.md b/src/PowerShell/Help/Microsoft.WinGet.Client/Enable-WinGetSetting.md @@ -82,6 +82,6 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## RELATED LINKS -[Get-WinGetSettings](Get-WinGetSettings.md) +[Get-WinGetSetting](Get-WinGetSetting.md) [Disable-WinGetSetting](Disable-WinGetSetting.md) diff --git a/src/PowerShell/Help/Microsoft.WinGet.Client/Get-WinGetSetting.md b/src/PowerShell/Help/Microsoft.WinGet.Client/Get-WinGetSetting.md @@ -0,0 +1,102 @@ +--- +external help file: Microsoft.WinGet.Client.Cmdlets.dll-Help.xml +Module Name: Microsoft.WinGet.Client +ms.date: 08/01/2024 +online version: +schema: 2.0.0 +title: Get-WinGetSetting +--- + +# Get-WinGetSetting + +## SYNOPSIS +Gets WinGet configuration settings. + +## SYNTAX + +``` +Get-WinGetSetting [-AsPlainText] [<CommonParameters>] +``` + +## DESCRIPTION + +This command gets the WinGet configuration settings. The settings include: +- the schema +- administrative settings +- the location of the user settings file +For more information about WinGet settings, see +[WinGet CLI Settings](https://aka.ms/winget-settings). + +## EXAMPLES + +### Example 1 - Display the WinGet configuration settings + +```powershell +Get-WinGetSetting +``` + +```Output + +Name Value +---- ----- +$schema https://aka.ms/winget-settings-export.schema.json +userSettingsFile C:\Users\user1\AppData\Local\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\Local… +adminSettings {[ProxyCommandLineOptions, False], [LocalArchiveMalwareScanOverride, False], [InstallerH… +``` + +### Example 2 - Display the administrative settings in WinGet configuration + +```powershell +Get-WinGetSetting | Select-Object -ExpandProperty adminSettings +``` + +```Output +Name Value +---- ----- +InstallerHashOverride False +ProxyCommandLineOptions False +BypassCertificatePinningForMicrosoftStore False +LocalArchiveMalwareScanOverride False +LocalManifestFiles True +``` + +## PARAMETERS + +### -AsPlainText + +Output results as plain text + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: True (ByPropertyName) +Accept wildcard characters: False +``` + +### CommonParameters + +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, +-InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, +-ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see +[about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### System.Management.Automation.SwitchParameter + +## OUTPUTS + +### System.Object + +## NOTES + +## RELATED LINKS + +[Get-WinGetUserSetting](Get-WinGetUserSetting.md) + +[Set-WinGetUserSetting](Set-WinGetUserSetting.md) diff --git a/src/PowerShell/Help/Microsoft.WinGet.Client/Get-WinGetSettings.md b/src/PowerShell/Help/Microsoft.WinGet.Client/Get-WinGetSettings.md @@ -1,102 +0,0 @@ ---- -external help file: Microsoft.WinGet.Client.Cmdlets.dll-Help.xml -Module Name: Microsoft.WinGet.Client -ms.date: 08/01/2024 -online version: -schema: 2.0.0 -title: Get-WinGetSettings ---- - -# Get-WinGetSettings - -## SYNOPSIS -Gets WinGet configuration settings. - -## SYNTAX - -``` -Get-WinGetSettings [-AsPlainText] [<CommonParameters>] -``` - -## DESCRIPTION - -This command gets the WinGet configuration settings. The settings include: -- the schema -- administrative settings -- the location of the user settings file -For more information about WinGet settings, see -[WinGet CLI Settings](https://aka.ms/winget-settings). - -## EXAMPLES - -### Example 1 - Display the WinGet configuration settings - -```powershell -Get-WinGetSettings -``` - -```Output - -Name Value ----- ----- -$schema https://aka.ms/winget-settings-export.schema.json -userSettingsFile C:\Users\user1\AppData\Local\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\Local… -adminSettings {[ProxyCommandLineOptions, False], [LocalArchiveMalwareScanOverride, False], [InstallerH… -``` - -### Example 2 - Display the administrative settings in WinGet configuration - -```powershell -Get-WinGetSettings | Select-Object -ExpandProperty adminSettings -``` - -```Output -Name Value ----- ----- -InstallerHashOverride False -ProxyCommandLineOptions False -BypassCertificatePinningForMicrosoftStore False -LocalArchiveMalwareScanOverride False -LocalManifestFiles True -``` - -## PARAMETERS - -### -AsPlainText - -Output results as plain text - -```yaml -Type: System.Management.Automation.SwitchParameter -Parameter Sets: (All) -Aliases: - -Required: False -Position: Named -Default value: None -Accept pipeline input: True (ByPropertyName) -Accept wildcard characters: False -``` - -### CommonParameters - -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, --InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, --ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see -[about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). - -## INPUTS - -### System.Management.Automation.SwitchParameter - -## OUTPUTS - -### System.Object - -## NOTES - -## RELATED LINKS - -[Get-WinGetUserSettings](Get-WinGetUserSettings.md) - -[Set-WinGetUserSettings](Set-WinGetUserSettings.md) diff --git a/src/PowerShell/Help/Microsoft.WinGet.Client/Get-WinGetUserSetting.md b/src/PowerShell/Help/Microsoft.WinGet.Client/Get-WinGetUserSetting.md @@ -0,0 +1,58 @@ +--- +external help file: Microsoft.WinGet.Client.Cmdlets.dll-Help.xml +Module Name: Microsoft.WinGet.Client +ms.date: 08/01/2024 +online version: +schema: 2.0.0 +title: Get-WinGetUserSetting +--- + +# Get-WinGetUserSetting + +## SYNOPSIS +Gets user settings for WinGet. + +## SYNTAX + +``` +Get-WinGetUserSetting [<CommonParameters>] +``` + +## DESCRIPTION + +This command displays the WinGet settings for the current user. The settings are stored in +`$env:LOCALAPPDATA\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\settings.json`. +This file only exists if you have changed a user setting, for example, using the `Set-WinGetUserSetting` command. + +## EXAMPLES + +### Example 1: Get the WinGet settings for the current user + +```powershell +Get-WinGetUserSetting +``` + +## PARAMETERS + +### CommonParameters + +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, +-InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, +-ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see +[about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### None + +## OUTPUTS + +### System.Collections.Hashtable + +## NOTES + +## RELATED LINKS + +[Get-WinGetSetting](Get-WinGetSetting.md) + +[Set-WinGetUserSetting](Set-WinGetUserSetting.md) diff --git a/src/PowerShell/Help/Microsoft.WinGet.Client/Get-WinGetUserSettings.md b/src/PowerShell/Help/Microsoft.WinGet.Client/Get-WinGetUserSettings.md @@ -1,58 +0,0 @@ ---- -external help file: Microsoft.WinGet.Client.Cmdlets.dll-Help.xml -Module Name: Microsoft.WinGet.Client -ms.date: 08/01/2024 -online version: -schema: 2.0.0 -title: Get-WinGetUserSettings ---- - -# Get-WinGetUserSettings - -## SYNOPSIS -Gets user settings for WinGet. - -## SYNTAX - -``` -Get-WinGetUserSettings [<CommonParameters>] -``` - -## DESCRIPTION - -This command displays the WinGet settings for the current user. The settings are stored in -`$env:LOCALAPPDATA\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\settings.json`. -This file only exists if you have changed a user setting, for example, using the `Set-WinGetUserSettings` command. - -## EXAMPLES - -### Example 1: Get the WinGet settings for the current user - -```powershell -Get-WinGetUserSettings -``` - -## PARAMETERS - -### CommonParameters - -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, --InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, --ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see -[about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). - -## INPUTS - -### None - -## OUTPUTS - -### System.Collections.Hashtable - -## NOTES - -## RELATED LINKS - -[Get-WinGetSettings](Get-WinGetSettings.md) - -[Set-WinGetUserSettings](Set-WinGetUserSettings.md) diff --git a/src/PowerShell/Help/Microsoft.WinGet.Client/Microsoft.WinGet.Client.md b/src/PowerShell/Help/Microsoft.WinGet.Client/Microsoft.WinGet.Client.md @@ -34,13 +34,13 @@ Searches configured sources for packages. ### [Get-WinGetPackage](Get-WinGetPackage.md) Gets installed packages. -### [Get-WinGetSettings](Get-WinGetSettings.md) +### [Get-WinGetSetting](Get-WinGetSetting.md) Gets WinGet settings. ### [Get-WinGetSource](Get-WinGetSource.md) Gets configured WinGet sources. -### [Get-WinGetUserSettings](Get-WinGetUserSettings.md) +### [Get-WinGetUserSetting](Get-WinGetUserSetting.md) Gets user settings for WinGet. ### [Get-WinGetVersion](Get-WinGetVersion.md) @@ -58,10 +58,10 @@ Repairs the WinGet client. ### [Reset-WinGetSource](Reset-WinGetSource.md) Resets default WinGet sources. -### [Set-WinGetUserSettings](Set-WinGetUserSettings.md) +### [Set-WinGetUserSetting](Set-WinGetUserSetting.md) Sets WinGet settings. -### [Test-WinGetUserSettings](Test-WinGetUserSettings.md) +### [Test-WinGetUserSetting](Test-WinGetUserSetting.md) Tests WinGet settings. ### [Uninstall-WinGetPackage](Uninstall-WinGetPackage.md) diff --git a/src/PowerShell/Help/Microsoft.WinGet.Client/Set-WinGetUserSetting.md b/src/PowerShell/Help/Microsoft.WinGet.Client/Set-WinGetUserSetting.md @@ -0,0 +1,126 @@ +--- +external help file: Microsoft.WinGet.Client.Cmdlets.dll-Help.xml +Module Name: Microsoft.WinGet.Client +ms.date: 08/01/2024 +online version: +schema: 2.0.0 +title: Set-WinGetUserSetting +--- + +# Set-WinGetUserSetting + +## SYNOPSIS +Sets configuration settings of the WinGet client for the current user. + +## SYNTAX + +``` +Set-WinGetUserSetting -UserSettings <Hashtable> [-Merge] [<CommonParameters>] +``` + +## DESCRIPTION + +This command sets configuration settings of the WinGet client for the current user. The user +settings file doesn't exist until you set a specific value. The file is stored in +`$env:LOCALAPPDATA\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\settings.json`. +For more information about WinGet settings, see +[WinGet CLI Settings](https://aka.ms/winget-settings). + +## EXAMPLES + +### Example 1: Set progress bar theme + +```powershell +Set-WinGetUserSetting -UserSettings @{ + visual = @{ + progressBar = 'rainbow' + } +} +``` + +Sets the theme of the progress bar to rainbow. + +### Example 2: Merge install behavior settings + +```powershell +Set-WinGetUserSetting -Merge -UserSettings @{ + installBehavior = @{ + preferences = @{ + scope = 'user' + } + } +} +``` + +Appends the user scope preference setting to the existing WinGet settings configuration. + +### Example 3: Change multiple settings + +```powershell +Set-WinGetUserSetting -UserSettings @{ + visual = @{ + progressBar = 'rainbow' + anonymizeDisplayedPaths = $true + } +} +``` + +## PARAMETERS + +### -Merge + +By default, the command overwrites the current setting with the values provided. Use this parameter +to append the new settings to the existing configuration. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: True (ByPropertyName) +Accept wildcard characters: False +``` + +### -UserSettings + +A hashtable containing the key value pairs representing the WinGet settings. + +```yaml +Type: System.Collections.Hashtable +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByPropertyName) +Accept wildcard characters: False +``` + +### CommonParameters + +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, +-InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, +-ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see +[about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### System.Collections.Hashtable + +### System.Management.Automation.SwitchParameter + +## OUTPUTS + +### System.Collections.Hashtable + +## NOTES + +## RELATED LINKS + +[Get-WinGetUserSetting](Get-WinGetUserSetting.md) + +[Test-WinGetUserSetting](Test-WinGetUserSetting.md) diff --git a/src/PowerShell/Help/Microsoft.WinGet.Client/Set-WinGetUserSettings.md b/src/PowerShell/Help/Microsoft.WinGet.Client/Set-WinGetUserSettings.md @@ -1,126 +0,0 @@ ---- -external help file: Microsoft.WinGet.Client.Cmdlets.dll-Help.xml -Module Name: Microsoft.WinGet.Client -ms.date: 08/01/2024 -online version: -schema: 2.0.0 -title: Set-WinGetUserSettings ---- - -# Set-WinGetUserSettings - -## SYNOPSIS -Sets configuration settings of the WinGet client for the current user. - -## SYNTAX - -``` -Set-WinGetUserSettings -UserSettings <Hashtable> [-Merge] [<CommonParameters>] -``` - -## DESCRIPTION - -This command sets configuration settings of the WinGet client for the current user. The user -settings file doesn't exist until you set a specific value. The file is stored in -`$env:LOCALAPPDATA\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\settings.json`. -For more information about WinGet settings, see -[WinGet CLI Settings](https://aka.ms/winget-settings). - -## EXAMPLES - -### Example 1: Set progress bar theme - -```powershell -Set-WinGetUserSettings -UserSettings @{ - visual = @{ - progressBar = 'rainbow' - } -} -``` - -Sets the theme of the progress bar to rainbow. - -### Example 2: Merge install behavior settings - -```powershell -Set-WinGetUserSettings -Merge -UserSettings @{ - installBehavior = @{ - preferences = @{ - scope = 'user' - } - } -} -``` - -Appends the user scope preference setting to the existing WinGet settings configuration. - -### Example 3: Change multiple settings - -```powershell -Set-WinGetUserSettings -UserSettings @{ - visual = @{ - progressBar = 'rainbow' - anonymizeDisplayedPaths = $true - } -} -``` - -## PARAMETERS - -### -Merge - -By default, the command overwrites the current setting with the values provided. Use this parameter -to append the new settings to the existing configuration. - -```yaml -Type: System.Management.Automation.SwitchParameter -Parameter Sets: (All) -Aliases: - -Required: False -Position: Named -Default value: None -Accept pipeline input: True (ByPropertyName) -Accept wildcard characters: False -``` - -### -UserSettings - -A hashtable containing the key value pairs representing the WinGet settings. - -```yaml -Type: System.Collections.Hashtable -Parameter Sets: (All) -Aliases: - -Required: True -Position: Named -Default value: None -Accept pipeline input: True (ByPropertyName) -Accept wildcard characters: False -``` - -### CommonParameters - -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, --InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, --ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see -[about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). - -## INPUTS - -### System.Collections.Hashtable - -### System.Management.Automation.SwitchParameter - -## OUTPUTS - -### System.Collections.Hashtable - -## NOTES - -## RELATED LINKS - -[Get-WinGetUserSettings](Get-WinGetUserSettings.md) - -[Test-WinGetUserSettings](Test-WinGetUserSettings.md) diff --git a/src/PowerShell/Help/Microsoft.WinGet.Client/Test-WinGetUserSetting.md b/src/PowerShell/Help/Microsoft.WinGet.Client/Test-WinGetUserSetting.md @@ -0,0 +1,114 @@ +--- +external help file: Microsoft.WinGet.Client.Cmdlets.dll-Help.xml +Module Name: Microsoft.WinGet.Client +ms.date: 08/01/2024 +online version: +schema: 2.0.0 +title: Test-WinGetUserSetting +--- + +# Test-WinGetUserSetting + +## SYNOPSIS +Tests the current state of WinGet user settings. + +## SYNTAX + +``` +Test-WinGetUserSetting -UserSettings <Hashtable> [-IgnoreNotSet] [<CommonParameters>] +``` + +## DESCRIPTION + +This command tests the current state of WinGet user settings against a provided set of values. + +## EXAMPLES + +### Example 1: Test for exact match + +```powershell +Test-WinGetUserSetting -UserSettings @{ + installBehavior = @{ + preferences = @{ + scope = 'user' + } + } +} +``` + +This example shows how to confirm that your current user settings match specific values. The +command returns `$false` if it is not an exact match. + +### Example 2: Test only progress bar setting + +```powershell +Test-WinGetUserSetting -IgnoreNotSet -UserSettings @{ + visual = @{ + progressBar = 'rainbow' + } +} +``` + +This examples tests whether the progress bar theme is set to `rainbow`. When you use the +**IgnoreNotSet** parameter, the command only tests the provide values and doesn't include other +WinGet settings in the comparison. + +## PARAMETERS + +### -IgnoreNotSet + +When you use the **IgnoreNotSet** parameter, the command only tests the provide values and doesn't +include other WinGet settings in the comparison. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: True (ByPropertyName) +Accept wildcard characters: False +``` + +### -UserSettings + +A hashtable containing the key value pairs representing the WinGet settings. + +```yaml +Type: System.Collections.Hashtable +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByPropertyName) +Accept wildcard characters: False +``` + +### CommonParameters + +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, +-InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, +-ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see +[about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### System.Collections.Hashtable + +### System.Management.Automation.SwitchParameter + +## OUTPUTS + +### System.Boolean + +## NOTES + +## RELATED LINKS + +[Get-WinGetUserSetting](Get-WinGetUserSetting.md) + +[Set-WinGetUserSetting](Set-WinGetUserSetting.md) diff --git a/src/PowerShell/Help/Microsoft.WinGet.Client/Test-WinGetUserSettings.md b/src/PowerShell/Help/Microsoft.WinGet.Client/Test-WinGetUserSettings.md @@ -1,114 +0,0 @@ ---- -external help file: Microsoft.WinGet.Client.Cmdlets.dll-Help.xml -Module Name: Microsoft.WinGet.Client -ms.date: 08/01/2024 -online version: -schema: 2.0.0 -title: Test-WinGetUserSettings ---- - -# Test-WinGetUserSettings - -## SYNOPSIS -Tests the current state of WinGet user settings. - -## SYNTAX - -``` -Test-WinGetUserSettings -UserSettings <Hashtable> [-IgnoreNotSet] [<CommonParameters>] -``` - -## DESCRIPTION - -This command tests the current state of WinGet user settings against a provided set of values. - -## EXAMPLES - -### Example 1: Test for exact match - -```powershell -Test-WinGetUserSettings -UserSettings @{ - installBehavior = @{ - preferences = @{ - scope = 'user' - } - } -} -``` - -This example shows how to confirm that your current user settings match specific values. The -command returns `$false` if it is not an exact match. - -### Example 2: Test only progress bar setting - -```powershell -Test-WinGetUserSettings -IgnoreNotSet -UserSettings @{ - visual = @{ - progressBar = 'rainbow' - } -} -``` - -This examples tests whether the progress bar theme is set to `rainbow`. When you use the -**IgnoreNotSet** parameter, the command only tests the provide values and doesn't include other -WinGet settings in the comparison. - -## PARAMETERS - -### -IgnoreNotSet - -When you use the **IgnoreNotSet** parameter, the command only tests the provide values and doesn't -include other WinGet settings in the comparison. - -```yaml -Type: System.Management.Automation.SwitchParameter -Parameter Sets: (All) -Aliases: - -Required: False -Position: Named -Default value: None -Accept pipeline input: True (ByPropertyName) -Accept wildcard characters: False -``` - -### -UserSettings - -A hashtable containing the key value pairs representing the WinGet settings. - -```yaml -Type: System.Collections.Hashtable -Parameter Sets: (All) -Aliases: - -Required: True -Position: Named -Default value: None -Accept pipeline input: True (ByPropertyName) -Accept wildcard characters: False -``` - -### CommonParameters - -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, --InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, --ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see -[about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). - -## INPUTS - -### System.Collections.Hashtable - -### System.Management.Automation.SwitchParameter - -## OUTPUTS - -### System.Boolean - -## NOTES - -## RELATED LINKS - -[Get-WinGetUserSettings](Get-WinGetUserSettings.md) - -[Set-WinGetUserSettings](Set-WinGetUserSettings.md) diff --git a/src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/AddSourceCmdlet.cs b/src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/AddSourceCmdlet.cs @@ -15,6 +15,7 @@ namespace Microsoft.WinGet.Client.Cmdlets.Cmdlets /// Adds a source. Requires admin. /// </summary> [Cmdlet(VerbsCommon.Add, Constants.WinGetNouns.Source)] + [Alias("awgs")] public sealed class AddSourceCmdlet : PSCmdlet { /// <summary> diff --git a/src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/AssertWinGetPackageManagerCmdlet.cs b/src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/AssertWinGetPackageManagerCmdlet.cs @@ -18,6 +18,7 @@ namespace Microsoft.WinGet.Client.Commands VerbsLifecycle.Assert, Constants.WinGetNouns.WinGetPackageManager, DefaultParameterSetName = Constants.IntegrityVersionSet)] + [Alias("awgpm")] public class AssertWinGetPackageManagerCmdlet : WinGetPackageManagerCmdlet { /// <summary> diff --git a/src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/DisableSettingCmdlet.cs b/src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/DisableSettingCmdlet.cs @@ -14,6 +14,7 @@ namespace Microsoft.WinGet.Client.Cmdlets.Cmdlets /// Disables an admin setting. Requires admin. /// </summary> [Cmdlet(VerbsLifecycle.Disable, Constants.WinGetNouns.Setting)] + [Alias("dwgs")] public sealed class DisableSettingCmdlet : PSCmdlet { /// <summary> diff --git a/src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/EnableSettingCmdlet.cs b/src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/EnableSettingCmdlet.cs @@ -14,6 +14,7 @@ namespace Microsoft.WinGet.Client.Cmdlets.Cmdlets /// Enables an admin setting. Requires admin. /// </summary> [Cmdlet(VerbsLifecycle.Enable, Constants.WinGetNouns.Setting)] + [Alias("ewgs")] public sealed class EnableSettingCmdlet : PSCmdlet { /// <summary> diff --git a/src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/ExportPackageCmdlet.cs b/src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/ExportPackageCmdlet.cs @@ -1,39 +1,40 @@ -// ----------------------------------------------------------------------------- -// <copyright file="ExportPackageCmdlet.cs" company="Microsoft Corporation"> -// Copyright (c) Microsoft Corporation. Licensed under the MIT License. -// </copyright> -// ----------------------------------------------------------------------------- - -namespace Microsoft.WinGet.Client.Commands -{ +// ----------------------------------------------------------------------------- +// <copyright file="ExportPackageCmdlet.cs" company="Microsoft Corporation"> +// Copyright (c) Microsoft Corporation. Licensed under the MIT License. +// </copyright> +// ----------------------------------------------------------------------------- + +namespace Microsoft.WinGet.Client.Commands +{ using System.Management.Automation; - using Microsoft.WinGet.Client.Common; - using Microsoft.WinGet.Client.Engine.Commands; + using Microsoft.WinGet.Client.Common; + using Microsoft.WinGet.Client.Engine.Commands; using Microsoft.WinGet.Client.Engine.PSObjects; - /// <summary> - /// Downloads a package installer from the pipeline or from a configured source. - /// </summary> - [Cmdlet( - VerbsData.Export, - Constants.WinGetNouns.Package, - DefaultParameterSetName = Constants.FoundSet, - SupportsShouldProcess = true)] - [OutputType(typeof(PSDownloadResult))] - public sealed class ExportPackageCmdlet : InstallerSelectionCmdlet - { + /// <summary> + /// Downloads a package installer from the pipeline or from a configured source. + /// </summary> + [Cmdlet( + VerbsData.Export, + Constants.WinGetNouns.Package, + DefaultParameterSetName = Constants.FoundSet, + SupportsShouldProcess = true)] + [Alias("ewgp")] + [OutputType(typeof(PSDownloadResult))] + public sealed class ExportPackageCmdlet : InstallerSelectionCmdlet + { private DownloadCommand command = null; /// <summary> /// Gets or sets the directory where the installer will be downloaded to. - /// </summary> - [Parameter(ValueFromPipelineByPropertyName = true)] + /// </summary> + [Parameter(ValueFromPipelineByPropertyName = true)] public string DownloadDirectory { get; set; } - /// <summary> - /// Installs a package from the pipeline or from a configured source. - /// </summary> - protected override void ProcessRecord() + /// <summary> + /// Installs a package from the pipeline or from a configured source. + /// </summary> + protected override void ProcessRecord() { this.command = new DownloadCommand( this, @@ -47,7 +48,7 @@ namespace Microsoft.WinGet.Client.Commands this.AllowHashMismatch.ToBool(), this.SkipDependencies.ToBool(), this.Locale); - this.command.Download(this.DownloadDirectory, this.MatchOption.ToString(), this.Scope.ToString(), this.Architecture.ToString(), this.InstallerType.ToString()); + this.command.Download(this.DownloadDirectory, this.MatchOption.ToString(), this.Scope.ToString(), this.Architecture.ToString(), this.InstallerType.ToString()); } /// <summary> @@ -59,6 +60,6 @@ namespace Microsoft.WinGet.Client.Commands { this.command.Cancel(); } - } - } -} + } + } +} diff --git a/src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/FindPackageCmdlet.cs b/src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/FindPackageCmdlet.cs @@ -1,28 +1,29 @@ -// ----------------------------------------------------------------------------- -// <copyright file="FindPackageCmdlet.cs" company="Microsoft Corporation"> -// Copyright (c) Microsoft Corporation. Licensed under the MIT License. -// </copyright> -// ----------------------------------------------------------------------------- - -namespace Microsoft.WinGet.Client.Commands -{ +// ----------------------------------------------------------------------------- +// <copyright file="FindPackageCmdlet.cs" company="Microsoft Corporation"> +// Copyright (c) Microsoft Corporation. Licensed under the MIT License. +// </copyright> +// ----------------------------------------------------------------------------- + +namespace Microsoft.WinGet.Client.Commands +{ using System.Management.Automation; - using Microsoft.WinGet.Client.Commands.Common; + using Microsoft.WinGet.Client.Commands.Common; using Microsoft.WinGet.Client.Common; using Microsoft.WinGet.Client.Engine.Commands; - using Microsoft.WinGet.Client.Engine.PSObjects; - - /// <summary> - /// Searches configured sources for packages. - /// </summary> - [Cmdlet(VerbsCommon.Find, Constants.WinGetNouns.Package)] - [OutputType(typeof(PSFoundCatalogPackage))] - public sealed class FindPackageCmdlet : FinderExtendedCmdlet - { - /// <summary> - /// Searches for configured sources for packages. - /// </summary> - protected override void ProcessRecord() + using Microsoft.WinGet.Client.Engine.PSObjects; + + /// <summary> + /// Searches configured sources for packages. + /// </summary> + [Cmdlet(VerbsCommon.Find, Constants.WinGetNouns.Package)] + [Alias("fdwgp")] + [OutputType(typeof(PSFoundCatalogPackage))] + public sealed class FindPackageCmdlet : FinderExtendedCmdlet + { + /// <summary> + /// Searches for configured sources for packages. + /// </summary> + protected override void ProcessRecord() { var command = new FinderPackageCommand( this, @@ -35,7 +36,7 @@ namespace Microsoft.WinGet.Client.Commands this.Command, this.Count); - command.Find(this.MatchOption.ToString()); - } - } -} + command.Find(this.MatchOption.ToString()); + } + } +} diff --git a/src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/GetPackageCmdlet.cs b/src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/GetPackageCmdlet.cs @@ -16,6 +16,7 @@ namespace Microsoft.WinGet.Client.Commands /// Searches configured sources for packages. /// </summary> [Cmdlet(VerbsCommon.Get, Constants.WinGetNouns.Package)] + [Alias("gwgp")] [OutputType(typeof(PSInstalledCatalogPackage))] public sealed class GetPackageCmdlet : FinderExtendedCmdlet { diff --git a/src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/GetSettingCmdlet.cs b/src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/GetSettingCmdlet.cs @@ -0,0 +1,35 @@ +// ----------------------------------------------------------------------------- +// <copyright file="GetSettingCmdlet.cs" company="Microsoft Corporation"> +// Copyright (c) Microsoft Corporation. Licensed under the MIT License. +// </copyright> +// ----------------------------------------------------------------------------- + +namespace Microsoft.WinGet.Client.Cmdlets.Cmdlets +{ + using System.Management.Automation; + using Microsoft.WinGet.Client.Common; + using Microsoft.WinGet.Client.Engine.Commands; + + /// <summary> + /// Gets winget settings. + /// </summary> + [Cmdlet(VerbsCommon.Get, Constants.WinGetNouns.Setting)] + [Alias("gwgse", "Get-WinGetSettings")] + public sealed class GetSettingCmdlet : PSCmdlet + { + /// <summary> + /// Gets or sets a value indicating whether to output a string or a hashtable. + /// </summary> + [Parameter(ValueFromPipelineByPropertyName = true)] + public SwitchParameter AsPlainText { get; set; } + + /// <summary> + /// Get settings. + /// </summary> + protected override void ProcessRecord() + { + var command = new CliCommand(this); + command.GetSettings(this.AsPlainText.ToBool()); + } + } +} diff --git a/src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/GetSettingsCmdlet.cs b/src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/GetSettingsCmdlet.cs @@ -1,34 +0,0 @@ -// ----------------------------------------------------------------------------- -// <copyright file="GetSettingsCmdlet.cs" company="Microsoft Corporation"> -// Copyright (c) Microsoft Corporation. Licensed under the MIT License. -// </copyright> -// ----------------------------------------------------------------------------- - -namespace Microsoft.WinGet.Client.Cmdlets.Cmdlets -{ - using System.Management.Automation; - using Microsoft.WinGet.Client.Common; - using Microsoft.WinGet.Client.Engine.Commands; - - /// <summary> - /// Gets winget settings. - /// </summary> - [Cmdlet(VerbsCommon.Get, Constants.WinGetNouns.Settings)] - public sealed class GetSettingsCmdlet : PSCmdlet - { - /// <summary> - /// Gets or sets a value indicating whether to output a string or a hashtable. - /// </summary> - [Parameter(ValueFromPipelineByPropertyName = true)] - public SwitchParameter AsPlainText { get; set; } - - /// <summary> - /// Get settings. - /// </summary> - protected override void ProcessRecord() - { - var command = new CliCommand(this); - command.GetSettings(this.AsPlainText.ToBool()); - } - } -} diff --git a/src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/GetSourceCmdlet.cs b/src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/GetSourceCmdlet.cs @@ -1,39 +1,40 @@ -// ----------------------------------------------------------------------------- -// <copyright file="GetSourceCmdlet.cs" company="Microsoft Corporation"> -// Copyright (c) Microsoft Corporation. Licensed under the MIT License. -// </copyright> -// ----------------------------------------------------------------------------- - -namespace Microsoft.WinGet.Client.Commands -{ - using System.Management.Automation; +// ----------------------------------------------------------------------------- +// <copyright file="GetSourceCmdlet.cs" company="Microsoft Corporation"> +// Copyright (c) Microsoft Corporation. Licensed under the MIT License. +// </copyright> +// ----------------------------------------------------------------------------- + +namespace Microsoft.WinGet.Client.Commands +{ + using System.Management.Automation; using Microsoft.WinGet.Client.Common; using Microsoft.WinGet.Client.Engine.Commands; using Microsoft.WinGet.Client.Engine.PSObjects; - /// <summary> - /// Retrieves the list of configured sources. - /// </summary> - [Cmdlet(VerbsCommon.Get, Constants.WinGetNouns.Source)] - [OutputType(typeof(PSSourceResult))] - public sealed class GetSourceCmdlet : PSCmdlet - { - /// <summary> - /// Gets or sets the name of the source to retrieve. - /// </summary> - [Parameter( - Position = 0, - ValueFromPipeline = true, - ValueFromPipelineByPropertyName = true)] - public string Name { get; set; } - - /// <summary> - /// Returns the list of configured sources. - /// </summary> - protected override void ProcessRecord() - { - var command = new SourceCommand(this); - command.Get(this.Name); - } - } -} + /// <summary> + /// Retrieves the list of configured sources. + /// </summary> + [Cmdlet(VerbsCommon.Get, Constants.WinGetNouns.Source)] + [Alias("gwgso")] + [OutputType(typeof(PSSourceResult))] + public sealed class GetSourceCmdlet : PSCmdlet + { + /// <summary> + /// Gets or sets the name of the source to retrieve. + /// </summary> + [Parameter( + Position = 0, + ValueFromPipeline = true, + ValueFromPipelineByPropertyName = true)] + public string Name { get; set; } + + /// <summary> + /// Returns the list of configured sources. + /// </summary> + protected override void ProcessRecord() + { + var command = new SourceCommand(this); + command.Get(this.Name); + } + } +} diff --git a/src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/GetUserSettingCmdlet.cs b/src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/GetUserSettingCmdlet.cs @@ -0,0 +1,31 @@ +// ----------------------------------------------------------------------------- +// <copyright file="GetUserSettingCmdlet.cs" company="Microsoft Corporation"> +// Copyright (c) Microsoft Corporation. Licensed under the MIT License. +// </copyright> +// ----------------------------------------------------------------------------- + +namespace Microsoft.WinGet.Client.Commands +{ + using System.Collections; + using System.Management.Automation; + using Microsoft.WinGet.Client.Common; + using Microsoft.WinGet.Client.Engine.Commands; + + /// <summary> + /// Gets winget's user settings. + /// </summary> + [Cmdlet(VerbsCommon.Get, Constants.WinGetNouns.UserSetting)] + [Alias("gwgus", "Get-WinGetUserSettings")] + [OutputType(typeof(Hashtable))] + public sealed class GetUserSettingCmdlet : PSCmdlet + { + /// <summary> + /// Gets the settings file contents. + /// </summary> + protected override void ProcessRecord() + { + var command = new UserSettingsCommand(this); + command.Get(); + } + } +} diff --git a/src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/GetUserSettingsCmdlet.cs b/src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/GetUserSettingsCmdlet.cs @@ -1,30 +0,0 @@ -// ----------------------------------------------------------------------------- -// <copyright file="GetUserSettingsCmdlet.cs" company="Microsoft Corporation"> -// Copyright (c) Microsoft Corporation. Licensed under the MIT License. -// </copyright> -// ----------------------------------------------------------------------------- - -namespace Microsoft.WinGet.Client.Commands -{ - using System.Collections; - using System.Management.Automation; - using Microsoft.WinGet.Client.Common; - using Microsoft.WinGet.Client.Engine.Commands; - - /// <summary> - /// Gets winget's user settings. - /// </summary> - [Cmdlet(VerbsCommon.Get, Constants.WinGetNouns.UserSettings)] - [OutputType(typeof(Hashtable))] - public sealed class GetUserSettingsCmdlet : PSCmdlet - { - /// <summary> - /// Gets the settings file contents. - /// </summary> - protected override void ProcessRecord() - { - var command = new UserSettingsCommand(this); - command.Get(); - } - } -} diff --git a/src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/GetVersionCmdlet.cs b/src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/GetVersionCmdlet.cs @@ -14,6 +14,7 @@ namespace Microsoft.WinGet.Client.Commands /// Get-WinGetVersion. Gets the current version of winget. /// </summary> [Cmdlet(VerbsCommon.Get, Constants.WinGetNouns.Version)] + [Alias("gwgv")] [OutputType(typeof(string))] public class GetVersionCmdlet : PSCmdlet { diff --git a/src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/InstallPackageCmdlet.cs b/src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/InstallPackageCmdlet.cs @@ -20,6 +20,7 @@ namespace Microsoft.WinGet.Client.Commands Constants.WinGetNouns.Package, DefaultParameterSetName = Constants.FoundSet, SupportsShouldProcess = true)] + [Alias("iswgp")] [OutputType(typeof(PSInstallResult))] public sealed class InstallPackageCmdlet : InstallCmdlet { diff --git a/src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/RemoveSourceCmdlet.cs b/src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/RemoveSourceCmdlet.cs @@ -14,6 +14,7 @@ namespace Microsoft.WinGet.Client.Cmdlets /// Removes a source. Requires admin. /// </summary> [Cmdlet(VerbsCommon.Remove, Constants.WinGetNouns.Source)] + [Alias("rwgs")] public sealed class RemoveSourceCmdlet : PSCmdlet { /// <summary> diff --git a/src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/RepairWinGetPackageManagerCmdlet.cs b/src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/RepairWinGetPackageManagerCmdlet.cs @@ -18,6 +18,7 @@ namespace Microsoft.WinGet.Client.Commands VerbsDiagnostic.Repair, Constants.WinGetNouns.WinGetPackageManager, DefaultParameterSetName = Constants.IntegrityVersionSet)] + [Alias("rpwgpm")] [OutputType(typeof(int))] public class RepairWinGetPackageManagerCmdlet : WinGetPackageManagerCmdlet { diff --git a/src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/ResetSourceCmdlet.cs b/src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/ResetSourceCmdlet.cs @@ -14,6 +14,7 @@ namespace Microsoft.WinGet.Client.Cmdlets.Cmdlets /// Resets a source. Requires admin. /// </summary> [Cmdlet(VerbsCommon.Reset, Constants.WinGetNouns.Source, DefaultParameterSetName = Constants.DefaultSet)] + [Alias("rswgs")] public sealed class ResetSourceCmdlet : PSCmdlet { /// <summary> diff --git a/src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/SetUserSettingCmdlet.cs b/src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/SetUserSettingCmdlet.cs @@ -0,0 +1,46 @@ +// ----------------------------------------------------------------------------- +// <copyright file="SetUserSettingCmdlet.cs" company="Microsoft Corporation"> +// Copyright (c) Microsoft Corporation. Licensed under the MIT License. +// </copyright> +// ----------------------------------------------------------------------------- + +namespace Microsoft.WinGet.Client.Commands +{ + using System.Collections; + using System.Management.Automation; + using Microsoft.WinGet.Client.Common; + using Microsoft.WinGet.Client.Engine.Commands; + + /// <summary> + /// Sets the specified user settings into the winget user settings. If the merge switch is on, merges current user + /// settings with the input settings. Otherwise, overwrites the input settings. + /// </summary> + [Cmdlet(VerbsCommon.Set, Constants.WinGetNouns.UserSetting)] + [Alias("swgus", "Set-WinGetUserSettings")] + [OutputType(typeof(Hashtable))] + public sealed class SetUserSettingCmdlet : PSCmdlet + { + /// <summary> + /// Gets or sets the input user settings. + /// </summary> + [Parameter( + Mandatory = true, + ValueFromPipelineByPropertyName = true)] + public Hashtable UserSettings { get; set; } + + /// <summary> + /// Gets or sets a value indicating whether to merge the current user settings and the input settings. + /// </summary> + [Parameter(ValueFromPipelineByPropertyName = true)] + public SwitchParameter Merge { get; set; } + + /// <summary> + /// Process input of cmdlet. + /// </summary> + protected override void ProcessRecord() + { + var command = new UserSettingsCommand(this); + command.Set(this.UserSettings, this.Merge.ToBool()); + } + } +} diff --git a/src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/SetUserSettingsCmdlet.cs b/src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/SetUserSettingsCmdlet.cs @@ -1,45 +0,0 @@ -// ----------------------------------------------------------------------------- -// <copyright file="SetUserSettingsCmdlet.cs" company="Microsoft Corporation"> -// Copyright (c) Microsoft Corporation. Licensed under the MIT License. -// </copyright> -// ----------------------------------------------------------------------------- - -namespace Microsoft.WinGet.Client.Commands -{ - using System.Collections; - using System.Management.Automation; - using Microsoft.WinGet.Client.Common; - using Microsoft.WinGet.Client.Engine.Commands; - - /// <summary> - /// Sets the specified user settings into the winget user settings. If the merge switch is on, merges current user - /// settings with the input settings. Otherwise, overwrites the input settings. - /// </summary> - [Cmdlet(VerbsCommon.Set, Constants.WinGetNouns.UserSettings)] - [OutputType(typeof(Hashtable))] - public sealed class SetUserSettingsCmdlet : PSCmdlet - { - /// <summary> - /// Gets or sets the input user settings. - /// </summary> - [Parameter( - Mandatory = true, - ValueFromPipelineByPropertyName = true)] - public Hashtable UserSettings { get; set; } - - /// <summary> - /// Gets or sets a value indicating whether to merge the current user settings and the input settings. - /// </summary> - [Parameter(ValueFromPipelineByPropertyName = true)] - public SwitchParameter Merge { get; set; } - - /// <summary> - /// Process input of cmdlet. - /// </summary> - protected override void ProcessRecord() - { - var command = new UserSettingsCommand(this); - command.Set(this.UserSettings, this.Merge.ToBool()); - } - } -} diff --git a/src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/TestUserSettingCmdlet.cs b/src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/TestUserSettingCmdlet.cs @@ -0,0 +1,45 @@ +// ----------------------------------------------------------------------------- +// <copyright file="TestUserSettingCmdlet.cs" company="Microsoft Corporation"> +// Copyright (c) Microsoft Corporation. Licensed under the MIT License. +// </copyright> +// ----------------------------------------------------------------------------- + +namespace Microsoft.WinGet.Client.Commands +{ + using System.Collections; + using System.Management.Automation; + using Microsoft.WinGet.Client.Common; + using Microsoft.WinGet.Client.Engine.Commands; + + /// <summary> + /// Compare the specified user settings with the winget user settings. + /// </summary> + [Cmdlet(VerbsDiagnostic.Test, Constants.WinGetNouns.UserSetting)] + [Alias("twgus", "Test-WinGetUserSettings")] + [OutputType(typeof(bool))] + public sealed class TestUserSettingCmdlet : PSCmdlet + { + /// <summary> + /// Gets or sets the input user settings. + /// </summary> + [Parameter( + Mandatory = true, + ValueFromPipelineByPropertyName = true)] + public Hashtable UserSettings { get; set; } + + /// <summary> + /// Gets or sets a value indicating whether to ignore comparing settings that are not part of the input. + /// </summary> + [Parameter(ValueFromPipelineByPropertyName = true)] + public SwitchParameter IgnoreNotSet { get; set; } + + /// <summary> + /// Process the cmdlet and writes the result of the comparison. + /// </summary> + protected override void ProcessRecord() + { + var command = new UserSettingsCommand(this); + command.Test(this.UserSettings, this.IgnoreNotSet.ToBool()); + } + } +} diff --git a/src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/TestUserSettingsCmdlet.cs b/src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/TestUserSettingsCmdlet.cs @@ -1,44 +0,0 @@ -// ----------------------------------------------------------------------------- -// <copyright file="TestUserSettingsCmdlet.cs" company="Microsoft Corporation"> -// Copyright (c) Microsoft Corporation. Licensed under the MIT License. -// </copyright> -// ----------------------------------------------------------------------------- - -namespace Microsoft.WinGet.Client.Commands -{ - using System.Collections; - using System.Management.Automation; - using Microsoft.WinGet.Client.Common; - using Microsoft.WinGet.Client.Engine.Commands; - - /// <summary> - /// Compare the specified user settings with the winget user settings. - /// </summary> - [Cmdlet(VerbsDiagnostic.Test, Constants.WinGetNouns.UserSettings)] - [OutputType(typeof(bool))] - public sealed class TestUserSettingsCmdlet : PSCmdlet - { - /// <summary> - /// Gets or sets the input user settings. - /// </summary> - [Parameter( - Mandatory = true, - ValueFromPipelineByPropertyName = true)] - public Hashtable UserSettings { get; set; } - - /// <summary> - /// Gets or sets a value indicating whether to ignore comparing settings that are not part of the input. - /// </summary> - [Parameter(ValueFromPipelineByPropertyName = true)] - public SwitchParameter IgnoreNotSet { get; set; } - - /// <summary> - /// Process the cmdlet and writes the result of the comparison. - /// </summary> - protected override void ProcessRecord() - { - var command = new UserSettingsCommand(this); - command.Test(this.UserSettings, this.IgnoreNotSet.ToBool()); - } - } -} diff --git a/src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/UninstallPackageCmdlet.cs b/src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/UninstallPackageCmdlet.cs @@ -1,53 +1,54 @@ -// ----------------------------------------------------------------------------- -// <copyright file="UninstallPackageCmdlet.cs" company="Microsoft Corporation"> -// Copyright (c) Microsoft Corporation. Licensed under the MIT License. -// </copyright> -// ----------------------------------------------------------------------------- - -namespace Microsoft.WinGet.Client.Commands -{ +// ----------------------------------------------------------------------------- +// <copyright file="UninstallPackageCmdlet.cs" company="Microsoft Corporation"> +// Copyright (c) Microsoft Corporation. Licensed under the MIT License. +// </copyright> +// ----------------------------------------------------------------------------- + +namespace Microsoft.WinGet.Client.Commands +{ using System.Management.Automation; - using Microsoft.WinGet.Client.Commands.Common; - using Microsoft.WinGet.Client.Common; - using Microsoft.WinGet.Client.Engine.Commands; + using Microsoft.WinGet.Client.Commands.Common; + using Microsoft.WinGet.Client.Common; + using Microsoft.WinGet.Client.Engine.Commands; using Microsoft.WinGet.Client.Engine.PSObjects; using Microsoft.WinGet.Client.PSObjects; - /// <summary> - /// Uninstalls a package from the local system. - /// </summary> - [Cmdlet( - VerbsLifecycle.Uninstall, - Constants.WinGetNouns.Package, - DefaultParameterSetName = Constants.FoundSet, - SupportsShouldProcess = true)] - [OutputType(typeof(PSUninstallResult))] - public sealed class UninstallPackageCmdlet : PackageCmdlet - { - private UninstallPackageCommand command = null; - - /// <summary> - /// Gets or sets the desired mode for the uninstallation process. - /// </summary> - [Parameter(ValueFromPipelineByPropertyName = true)] - public PSPackageUninstallMode Mode { get; set; } = PSPackageUninstallMode.Default; - - /// <summary> - /// Gets or sets a value indicating whether to continue upon non security related failures. - /// </summary> - [Parameter(ValueFromPipelineByPropertyName = true)] + /// <summary> + /// Uninstalls a package from the local system. + /// </summary> + [Cmdlet( + VerbsLifecycle.Uninstall, + Constants.WinGetNouns.Package, + DefaultParameterSetName = Constants.FoundSet, + SupportsShouldProcess = true)] + [Alias("uswgp")] + [OutputType(typeof(PSUninstallResult))] + public sealed class UninstallPackageCmdlet : PackageCmdlet + { + private UninstallPackageCommand command = null; + + /// <summary> + /// Gets or sets the desired mode for the uninstallation process. + /// </summary> + [Parameter(ValueFromPipelineByPropertyName = true)] + public PSPackageUninstallMode Mode { get; set; } = PSPackageUninstallMode.Default; + + /// <summary> + /// Gets or sets a value indicating whether to continue upon non security related failures. + /// </summary> + [Parameter(ValueFromPipelineByPropertyName = true)] public SwitchParameter Force { get; set; } - /// <summary> - /// Gets or sets the path to the logging file. - /// </summary> - [Parameter(ValueFromPipelineByPropertyName = true)] - public string Log { get; set; } - - /// <summary> - /// Uninstalls a package from the local system. - /// </summary> - protected override void ProcessRecord() + /// <summary> + /// Gets or sets the path to the logging file. + /// </summary> + [Parameter(ValueFromPipelineByPropertyName = true)] + public string Log { get; set; } + + /// <summary> + /// Uninstalls a package from the local system. + /// </summary> + protected override void ProcessRecord() { this.command = new UninstallPackageCommand( this, @@ -59,7 +60,7 @@ namespace Microsoft.WinGet.Client.Commands this.Moniker, this.Source, this.Query); - this.command.Uninstall(this.MatchOption.ToString(), this.Mode.ToString(), this.Force.ToBool()); + this.command.Uninstall(this.MatchOption.ToString(), this.Mode.ToString(), this.Force.ToBool()); } /// <summary> @@ -71,6 +72,6 @@ namespace Microsoft.WinGet.Client.Commands { this.command.Cancel(); } - } - } -} + } + } +} diff --git a/src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/UpdatePackageCmdlet.cs b/src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/UpdatePackageCmdlet.cs @@ -1,38 +1,39 @@ -// ----------------------------------------------------------------------------- -// <copyright file="UpdatePackageCmdlet.cs" company="Microsoft Corporation"> -// Copyright (c) Microsoft Corporation. Licensed under the MIT License. -// </copyright> -// ----------------------------------------------------------------------------- - -namespace Microsoft.WinGet.Client.Commands -{ +// ----------------------------------------------------------------------------- +// <copyright file="UpdatePackageCmdlet.cs" company="Microsoft Corporation"> +// Copyright (c) Microsoft Corporation. Licensed under the MIT License. +// </copyright> +// ----------------------------------------------------------------------------- + +namespace Microsoft.WinGet.Client.Commands +{ using System.Management.Automation; using Microsoft.WinGet.Client.Commands.Common; using Microsoft.WinGet.Client.Common; using Microsoft.WinGet.Client.Engine.Commands; using Microsoft.WinGet.Client.Engine.PSObjects; - /// <summary> - /// This commands updates a package from the pipeline or from the local system. - /// </summary> - [Cmdlet( - VerbsData.Update, - Constants.WinGetNouns.Package, - DefaultParameterSetName = Constants.FoundSet, - SupportsShouldProcess = true)] - [OutputType(typeof(PSInstallResult))] - public sealed class UpdatePackageCmdlet : InstallCmdlet - { - /// <summary> - /// Gets or sets a value indicating whether updating to an unknown version is allowed. - /// </summary> - [Parameter(ValueFromPipelineByPropertyName = true)] - public SwitchParameter IncludeUnknown { get; set; } - - /// <summary> - /// Updates a package from the pipeline or from the local system. - /// </summary> - protected override void ProcessRecord() + /// <summary> + /// This commands updates a package from the pipeline or from the local system. + /// </summary> + [Cmdlet( + VerbsData.Update, + Constants.WinGetNouns.Package, + DefaultParameterSetName = Constants.FoundSet, + SupportsShouldProcess = true)] + [Alias("udwgp")] + [OutputType(typeof(PSInstallResult))] + public sealed class UpdatePackageCmdlet : InstallCmdlet + { + /// <summary> + /// Gets or sets a value indicating whether updating to an unknown version is allowed. + /// </summary> + [Parameter(ValueFromPipelineByPropertyName = true)] + public SwitchParameter IncludeUnknown { get; set; } + + /// <summary> + /// Updates a package from the pipeline or from the local system. + /// </summary> + protected override void ProcessRecord() { var command = new InstallerPackageCommand( this, @@ -51,7 +52,7 @@ namespace Microsoft.WinGet.Client.Commands this.Source, this.Query, this.SkipDependencies); - command.Update(this.IncludeUnknown.ToBool(), this.MatchOption.ToString(), this.Scope.ToString(), this.Architecture.ToString(), this.Mode.ToString(), this.InstallerType.ToString()); - } - } -} + command.Update(this.IncludeUnknown.ToBool(), this.MatchOption.ToString(), this.Scope.ToString(), this.Architecture.ToString(), this.Mode.ToString(), this.InstallerType.ToString()); + } + } +} diff --git a/src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Common/Constants.cs b/src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Common/Constants.cs @@ -75,22 +75,17 @@ namespace Microsoft.WinGet.Client.Common /// <summary> /// The noun for any user settings cmdlet. /// </summary> - public const string UserSettings = "WinGetUserSettings"; + public const string UserSetting = "WinGetUserSetting"; /// <summary> /// The noun for winget version. /// </summary> public const string Version = "WinGetVersion"; - /// <summary> - /// The noun for enable/disable winget admin settings. + /// <summary> + /// The noun for enable/disable winget admin settings. /// </summary> public const string Setting = "WinGetSetting"; - - /// <summary> - /// The noun to get the winget settings. - /// </summary> - public const string Settings = "WinGetSettings"; } } } diff --git a/src/PowerShell/Microsoft.WinGet.Client.Engine/Commands/UserSettingsCommand.cs b/src/PowerShell/Microsoft.WinGet.Client.Engine/Commands/UserSettingsCommand.cs @@ -51,7 +51,7 @@ namespace Microsoft.WinGet.Client.Engine.Commands } /// <summary> - /// Get-WinGetUserSettings. + /// Get-WinGetUserSetting. /// </summary> public void Get() { @@ -59,7 +59,7 @@ namespace Microsoft.WinGet.Client.Engine.Commands } /// <summary> - /// Test-WinGetUserSettings. + /// Test-WinGetUserSetting. /// </summary> /// <param name="userSettings">Input user settings.</param> /// <param name="ignoreNotSet">Ignore comparing settings that are not part of the input.</param> @@ -69,7 +69,7 @@ namespace Microsoft.WinGet.Client.Engine.Commands } /// <summary> - /// Set-WinGetUserSettings. + /// Set-WinGetUserSetting. /// </summary> /// <param name="userSettings">Input user settings.</param> /// <param name="merge">Merge the current user settings and the input settings.</param> diff --git a/src/PowerShell/Microsoft.WinGet.Client/ModuleFiles/Microsoft.WinGet.Client.psd1 b/src/PowerShell/Microsoft.WinGet.Client/ModuleFiles/Microsoft.WinGet.Client.psd1 @@ -82,14 +82,14 @@ CmdletsToExport = @( 'Install-WinGetPackage' 'Uninstall-WinGetPackage' 'Update-WinGetPackage' - 'Get-WinGetUserSettings' - 'Set-WinGetUserSettings' - 'Test-WinGetUserSettings' + 'Get-WinGetUserSetting' + 'Set-WinGetUserSetting' + 'Test-WinGetUserSetting' 'Assert-WinGetPackageManager' 'Repair-WinGetPackageManager' 'Enable-WinGetSetting' 'Disable-WinGetSetting' - 'Get-WinGetSettings' + 'Get-WinGetSetting' 'Add-WinGetSource' 'Remove-WinGetSource' 'Reset-WinGetSource' @@ -100,7 +100,29 @@ CmdletsToExport = @( # VariablesToExport = @() # Aliases to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no aliases to export. -AliasesToExport = @() + AliasesToExport = @('awgs' + 'awgpm' + 'dwgs' + 'ewgs' + 'ewgp' + 'fdwgp' + 'gwgp' + 'gwgse' + 'gwgso' + 'gwgus' + 'gwgv' + 'iswgp' + 'rwgs' + 'rpwgpm' + 'rswgs' + 'swgus' + 'twgus' + 'uswgp' + 'udwgp', + 'Get-WinGetSettings' + 'Get-WinGetUserSettings' + 'Set-WinGetUserSettings' + 'Test-WinGetUserSettings') # DSC resources to export from this module # DscResourcesToExport = @() diff --git a/src/PowerShell/Microsoft.WinGet.Client/README.md b/src/PowerShell/Microsoft.WinGet.Client/README.md @@ -27,18 +27,18 @@ If the new cmdlet introduces a new dependency, please make sure to add it in the - Find-WinGetPackage - Get-WinGetPackage - Get-WinGetSource -- Get-WinGetUserSettings +- Get-WinGetUserSetting - Get-WinGetVersion - Install-WinGetPackage - Repair-WinGetPackageManager -- Set-WinGetUserSettings -- Test-WinGetUserSettings +- Set-WinGetUserSetting +- Test-WinGetUserSetting - Uninstall-WinGetPackage - Update-WinGetPackage - Add-WinGetSource - Disable-WinGetSetting - Enable-WinGetSetting -- Get-WinGetSettings +- Get-WinGetSetting - Remove-WinGetSource - Reset-WinGetSource diff --git a/src/PowerShell/Microsoft.WinGet.Configuration.Cmdlets/Cmdlets/CompleteWinGetConfigurationCmdlet.cs b/src/PowerShell/Microsoft.WinGet.Configuration.Cmdlets/Cmdlets/CompleteWinGetConfigurationCmdlet.cs @@ -16,6 +16,7 @@ namespace Microsoft.WinGet.Configuration.Cmdlets /// Waits for completion. /// </summary> [Cmdlet(VerbsLifecycle.Complete, "WinGetConfiguration")] + [Alias("cmpwgc")] public sealed class CompleteWinGetConfigurationCmdlet : PSCmdlet { private ConfigurationCommand runningCommand = null; diff --git a/src/PowerShell/Microsoft.WinGet.Configuration.Cmdlets/Cmdlets/ConfirmWinGetConfigurationCmdlet.cs b/src/PowerShell/Microsoft.WinGet.Configuration.Cmdlets/Cmdlets/ConfirmWinGetConfigurationCmdlet.cs @@ -15,6 +15,7 @@ namespace Microsoft.WinGet.Configuration.Cmdlets /// Validates winget configuration. /// </summary> [Cmdlet(VerbsLifecycle.Confirm, "WinGetConfiguration")] + [Alias("cnwgc")] public class ConfirmWinGetConfigurationCmdlet : PSCmdlet { private ConfigurationCommand runningCommand = null; diff --git a/src/PowerShell/Microsoft.WinGet.Configuration.Cmdlets/Cmdlets/ConvertToWinGetConfigurationYamlCmdlet.cs b/src/PowerShell/Microsoft.WinGet.Configuration.Cmdlets/Cmdlets/ConvertToWinGetConfigurationYamlCmdlet.cs @@ -15,6 +15,7 @@ namespace Microsoft.WinGet.Configuration.Cmdlets /// Serializes a PSConfigurationSet to a YAML string. /// </summary> [Cmdlet(VerbsData.ConvertTo, "WinGetConfigurationYaml")] + [Alias("ctwgcy")] public sealed class ConvertToWinGetConfigurationYamlCmdlet : PSCmdlet { /// <summary> diff --git a/src/PowerShell/Microsoft.WinGet.Configuration.Cmdlets/Cmdlets/GetWinGetConfigurationCmdlet.cs b/src/PowerShell/Microsoft.WinGet.Configuration.Cmdlets/Cmdlets/GetWinGetConfigurationCmdlet.cs @@ -15,6 +15,7 @@ namespace Microsoft.WinGet.Configuration.Cmdlets /// Opens a configuration set. /// </summary> [Cmdlet(VerbsCommon.Get, "WinGetConfiguration", DefaultParameterSetName = Helpers.Constants.ParameterSet.OpenConfigurationSetFromFile)] + [Alias("gwgc")] public sealed class GetWinGetConfigurationCmdlet : OpenConfiguration { /// <summary> diff --git a/src/PowerShell/Microsoft.WinGet.Configuration.Cmdlets/Cmdlets/GetWinGetConfigurationDetailsCmdlet.cs b/src/PowerShell/Microsoft.WinGet.Configuration.Cmdlets/Cmdlets/GetWinGetConfigurationDetailsCmdlet.cs @@ -16,6 +16,7 @@ namespace Microsoft.WinGet.Configuration.Cmdlets /// Gets the details for the units in a configuration set. /// </summary> [Cmdlet(VerbsCommon.Get, "WinGetConfigurationDetails")] + [Alias("gwgcd")] public sealed class GetWinGetConfigurationDetailsCmdlet : PSCmdlet { private ConfigurationCommand runningCommand = null; diff --git a/src/PowerShell/Microsoft.WinGet.Configuration.Cmdlets/Cmdlets/InvokeWinGetConfigurationCmdlet.cs b/src/PowerShell/Microsoft.WinGet.Configuration.Cmdlets/Cmdlets/InvokeWinGetConfigurationCmdlet.cs @@ -17,6 +17,7 @@ namespace Microsoft.WinGet.Configuration.Cmdlets /// Wait for completion. /// </summary> [Cmdlet(VerbsLifecycle.Invoke, "WinGetConfiguration")] + [Alias("iwgc")] public sealed class InvokeWinGetConfigurationCmdlet : PSCmdlet { private bool acceptedAgreements = false; diff --git a/src/PowerShell/Microsoft.WinGet.Configuration.Cmdlets/Cmdlets/RemoveWinGetConfigurationHistoryCmdlet.cs b/src/PowerShell/Microsoft.WinGet.Configuration.Cmdlets/Cmdlets/RemoveWinGetConfigurationHistoryCmdlet.cs @@ -15,6 +15,7 @@ namespace Microsoft.WinGet.Configuration.Cmdlets /// Removes the given configuration set from history. /// </summary> [Cmdlet(VerbsCommon.Remove, "WinGetConfigurationHistory")] + [Alias("rwgch")] public sealed class RemoveWinGetConfigurationHistoryCmdlet : PSCmdlet { /// <summary> diff --git a/src/PowerShell/Microsoft.WinGet.Configuration.Cmdlets/Cmdlets/StartWinGetConfigurationCmdlet.cs b/src/PowerShell/Microsoft.WinGet.Configuration.Cmdlets/Cmdlets/StartWinGetConfigurationCmdlet.cs @@ -16,6 +16,7 @@ namespace Microsoft.WinGet.Configuration.Cmdlets /// Does not wait for completion. /// </summary> [Cmdlet(VerbsLifecycle.Start, "WinGetConfiguration")] + [Alias("sawgc")] public sealed class StartWinGetConfigurationCmdlet : PSCmdlet { private bool acceptedAgreements = false; diff --git a/src/PowerShell/Microsoft.WinGet.Configuration.Cmdlets/Cmdlets/StopWinGetConfigurationCmdlet.cs b/src/PowerShell/Microsoft.WinGet.Configuration.Cmdlets/Cmdlets/StopWinGetConfigurationCmdlet.cs @@ -15,6 +15,7 @@ namespace Microsoft.WinGet.Configuration.Cmdlets /// Cancels a configuration previously started by Start-WinGetConfiguration. /// </summary> [Cmdlet(VerbsLifecycle.Stop, "WinGetConfiguration")] + [Alias("spwgc")] public sealed class StopWinGetConfigurationCmdlet : PSCmdlet { /// <summary> diff --git a/src/PowerShell/Microsoft.WinGet.Configuration.Cmdlets/Cmdlets/TestWinGetConfigurationCmdlet.cs b/src/PowerShell/Microsoft.WinGet.Configuration.Cmdlets/Cmdlets/TestWinGetConfigurationCmdlet.cs @@ -15,6 +15,7 @@ namespace Microsoft.WinGet.Configuration.Cmdlets /// Tests configuration. /// </summary> [Cmdlet(VerbsDiagnostic.Test, "WinGetConfiguration")] + [Alias("twgc")] public class TestWinGetConfigurationCmdlet : PSCmdlet { private bool acceptedAgreements = false; diff --git a/src/PowerShell/Microsoft.WinGet.Configuration/ModuleFiles/Microsoft.WinGet.Configuration.psd1 b/src/PowerShell/Microsoft.WinGet.Configuration/ModuleFiles/Microsoft.WinGet.Configuration.psd1 @@ -10,7 +10,7 @@ PowerShellVersion = '7.2.8' FunctionsToExport = @() - AliasesToExport = @() + AliasesToExport = @('cmpwgc', 'cnwgc', 'ctwgcy', 'gwgc', 'gwgcd', 'iwgc', 'rwgch', 'sawgc', 'spwgc','twgc') CmdletsToExport = @( "Complete-WinGetConfiguration" diff --git a/src/PowerShell/Microsoft.WinGet.DSC/Microsoft.WinGet.DSC.psm1 b/src/PowerShell/Microsoft.WinGet.DSC/Microsoft.WinGet.DSC.psm1 @@ -74,9 +74,9 @@ class WinGetUserSettings # Gets the current UserSettings by looking at the settings.json file for the current user. [WinGetUserSettings] Get() { - Assert-WinGetCommand "Get-WinGetUserSettings" + Assert-WinGetCommand "Get-WinGetUserSetting" - $userSettings = Get-WinGetUserSettings + $userSettings = Get-WinGetUserSetting $result = @{ SID = '' Settings = $userSettings @@ -87,7 +87,7 @@ class WinGetUserSettings # Tests if desired properties match. [bool] Test() { - Assert-WinGetCommand "Test-WinGetUserSettings" + Assert-WinGetCommand "Test-WinGetUserSetting" $hashArgs = @{ UserSettings = $this.Settings @@ -98,13 +98,13 @@ class WinGetUserSettings $hashArgs.Add('IgnoreNotSet', $true) } - return Test-WinGetUserSettings @hashArgs + return Test-WinGetUserSetting @hashArgs } # Sets the desired properties. [void] Set() { - Assert-WinGetCommand "Set-WinGetUserSettings" + Assert-WinGetCommand "Set-WinGetUserSetting" $hashArgs = @{ UserSettings = $this.Settings @@ -115,7 +115,7 @@ class WinGetUserSettings $hashArgs.Add('Merge', $true) } - Set-WinGetUserSettings @hashArgs + Set-WinGetUserSetting @hashArgs } } @@ -134,8 +134,8 @@ class WinGetAdminSettings # Gets the administrator settings. [WinGetAdminSettings] Get() { - Assert-WinGetCommand "Get-WinGetSettings" - $settingsJson = Get-WinGetSettings + Assert-WinGetCommand "Get-WinGetSetting" + $settingsJson = Get-WinGetSetting # Get admin setting values. $result = @{ diff --git a/src/PowerShell/tests/Microsoft.WinGet.Client.Tests.ps1 b/src/PowerShell/tests/Microsoft.WinGet.Client.Tests.ps1 @@ -441,13 +441,13 @@ Describe 'Export-WinGetPackage' { } } -Describe 'Get-WinGetUserSettings' { +Describe 'Get-WinGetUserSetting' { - It 'Get settings' { + It 'Get setting' { $ogSettings = @{ visual= @{ progressBar="rainbow"} ; experimentalFeatures= @{experimentalArg=$false ; experimentalCmd=$true}} SetWinGetSettingsHelper $ogSettings - $userSettings = Get-WinGetUserSettings + $userSettings = Get-WinGetUserSetting $userSettings | Should -Not -BeNullOrEmpty -ErrorAction Stop $userSettings.Count | Should -Be 2 $userSettings.visual.progressBar | Should -Be 'rainbow' @@ -457,31 +457,31 @@ Describe 'Get-WinGetUserSettings' { It 'Get settings. Bad json file' { Set-Content -Path $settingsFilePath -Value "Hi, im not a json. Thank you, Test." - { Get-WinGetUserSettings } | Should -Throw + { Get-WinGetUserSetting } | Should -Throw } } -Describe 'Test-WinGetUserSettings' { +Describe 'Test-WinGetUserSetting' { It 'Bad json file' { Set-Content -Path $settingsFilePath -Value "Hi, im not a json. Thank you, Test." $inputSettings = @{ visual= @{ progressBar="retro"} } - Test-WinGetUserSettings -UserSettings $inputSettings | Should -Be $false + Test-WinGetUserSetting -UserSettings $inputSettings | Should -Be $false } It 'Equal' { $ogSettings = @{ visual= @{ progressBar="retro"} ; experimentalFeatures= @{experimentalArg=$false ; experimentalCmd=$true}} SetWinGetSettingsHelper $ogSettings - Test-WinGetUserSettings -UserSettings $ogSettings | Should -Be $true + Test-WinGetUserSetting -UserSettings $ogSettings | Should -Be $true } It 'Equal. Ignore schema' { Set-Content -Path $settingsFilePath -Value '{ "$schema": "https://aka.ms/winget-settings.schema.json", "visual": { "progressBar": "retro" } }' $inputSettings = @{ visual= @{ progressBar="retro"} } - Test-WinGetUserSettings -UserSettings $inputSettings | Should -Be $true + Test-WinGetUserSetting -UserSettings $inputSettings | Should -Be $true } It 'Not Equal string' { @@ -489,7 +489,7 @@ Describe 'Test-WinGetUserSettings' { SetWinGetSettingsHelper $ogSettings $inputSettings = @{ visual= @{ progressBar="retro"} ; experimentalFeatures= @{experimentalArg=$false ; experimentalCmd=$true}} - Test-WinGetUserSettings -UserSettings $inputSettings | Should -Be $false + Test-WinGetUserSetting -UserSettings $inputSettings | Should -Be $false } It 'Not Equal bool' { @@ -497,7 +497,7 @@ Describe 'Test-WinGetUserSettings' { SetWinGetSettingsHelper $ogSettings $inputSettings = @{ visual= @{ progressBar="rainbow"} ; experimentalFeatures= @{experimentalArg=$false ; experimentalCmd=$true}} - Test-WinGetUserSettings -UserSettings $inputSettings | Should -Be $false + Test-WinGetUserSetting -UserSettings $inputSettings | Should -Be $false } It 'Not Equal. More settings' { @@ -505,7 +505,7 @@ Describe 'Test-WinGetUserSettings' { SetWinGetSettingsHelper $ogSettings $inputSettings = @{ visual= @{ progressBar="rainbow"} ; experimentalFeatures= @{experimentalArg=$false }} - Test-WinGetUserSettings -UserSettings $inputSettings | Should -Be $false + Test-WinGetUserSetting -UserSettings $inputSettings | Should -Be $false } It 'Not Equal. More settings input' { @@ -513,14 +513,14 @@ Describe 'Test-WinGetUserSettings' { SetWinGetSettingsHelper $ogSettings $inputSettings = @{ visual= @{ progressBar="rainbow"} ; experimentalFeatures= @{experimentalArg=$false ; experimentalCmd=$true}} - Test-WinGetUserSettings -UserSettings $inputSettings | Should -Be $false + Test-WinGetUserSetting -UserSettings $inputSettings | Should -Be $false } It 'Equal IgnoreNotSet' { $ogSettings = @{ visual= @{ progressBar="retro"} ; experimentalFeatures= @{experimentalArg=$false ; experimentalCmd=$true}} SetWinGetSettingsHelper $ogSettings - Test-WinGetUserSettings -UserSettings $ogSettings -IgnoreNotSet | Should -Be $true + Test-WinGetUserSetting -UserSettings $ogSettings -IgnoreNotSet | Should -Be $true } It 'Equal IgnoreNotSet. More settings' { @@ -528,7 +528,7 @@ Describe 'Test-WinGetUserSettings' { SetWinGetSettingsHelper $ogSettings $inputSettings = @{ visual= @{ progressBar="rainbow"} ; experimentalFeatures= @{experimentalArg=$false }} - Test-WinGetUserSettings -UserSettings $inputSettings -IgnoreNotSet | Should -Be $true + Test-WinGetUserSetting -UserSettings $inputSettings -IgnoreNotSet | Should -Be $true } It 'Not Equal IgnoreNotSet. More settings input' { @@ -536,7 +536,7 @@ Describe 'Test-WinGetUserSettings' { SetWinGetSettingsHelper $ogSettings $inputSettings = @{ visual= @{ progressBar="rainbow"} ; experimentalFeatures= @{experimentalArg=$false ; experimentalCmd=$true}} - Test-WinGetUserSettings -UserSettings $inputSettings -IgnoreNotSet | Should -Be $false + Test-WinGetUserSetting -UserSettings $inputSettings -IgnoreNotSet | Should -Be $false } It 'Not Equal bool IgnoreNotSet' { @@ -544,7 +544,7 @@ Describe 'Test-WinGetUserSettings' { SetWinGetSettingsHelper $ogSettings $inputSettings = @{ visual= @{ progressBar="rainbow"} ; experimentalFeatures= @{experimentalArg=$false ; experimentalCmd=$true}} - Test-WinGetUserSettings -UserSettings $inputSettings -IgnoreNotSet | Should -Be $false + Test-WinGetUserSetting -UserSettings $inputSettings -IgnoreNotSet | Should -Be $false } It 'Not Equal array IgnoreNotSet' { @@ -552,7 +552,7 @@ Describe 'Test-WinGetUserSettings' { SetWinGetSettingsHelper $ogSettings $inputSettings = @{ installBehavior= @{ preferences= @{ architectures = @("x86", "arm64")} }} - Test-WinGetUserSettings -UserSettings $inputSettings -IgnoreNotSet | Should -Be $false + Test-WinGetUserSetting -UserSettings $inputSettings -IgnoreNotSet | Should -Be $false } It 'Not Equal wrong type IgnoreNotSet' { @@ -560,22 +560,23 @@ Describe 'Test-WinGetUserSettings' { SetWinGetSettingsHelper $ogSettings $inputSettings = @{ visual= @{ progressBar="rainbow"} ; experimentalFeatures= @{experimentalArg=4 ; experimentalCmd=$true}} - Test-WinGetUserSettings -UserSettings $inputSettings -IgnoreNotSet | Should -Be $false + Test-WinGetUserSetting -UserSettings $inputSettings -IgnoreNotSet | Should -Be $false } + AfterAll { SetWinGetSettingsHelper @{ debugging= @{ enableSelfInitiatedMinidump=$true ; keepAllLogFiles=$true } } } } -Describe 'Set-WinGetUserSettings' { +Describe 'Set-WinGetUserSetting' { It 'Overwrites' { $ogSettings = @{ source= @{ autoUpdateIntervalInMinutes=3}} SetWinGetSettingsHelper $ogSettings $inputSettings = @{ visual= @{ progressBar="rainbow"} ; experimentalFeatures= @{experimentalArg=$true ; experimentalCmd=$false}} - $result = Set-WinGetUserSettings -UserSettings $inputSettings + $result = Set-WinGetUserSetting -UserSettings $inputSettings $result | Should -Not -BeNullOrEmpty -ErrorAction Stop $result.'$schema' | Should -Not -BeNullOrEmpty @@ -592,7 +593,7 @@ Describe 'Set-WinGetUserSettings' { SetWinGetSettingsHelper $ogSettings $inputSettings = @{ visual= @{ progressBar="rainbow"} ; experimentalFeatures= @{experimentalArg=$true ; experimentalCmd=$false}} - $result = Set-WinGetUserSettings -UserSettings $inputSettings -Merge + $result = Set-WinGetUserSetting -UserSettings $inputSettings -Merge $result | Should -Not -BeNullOrEmpty -ErrorAction Stop $result.'$schema' | Should -Not -BeNullOrEmpty @@ -609,7 +610,7 @@ Describe 'Set-WinGetUserSettings' { Set-Content -Path $settingsFilePath -Value '{ "$schema": "https://aka.ms/winget-settings.schema.json", "visual": { "progressBar": "retro" } }' $inputSettings = @{ visual= @{ progressBar="retro"} } - $result = Set-WinGetUserSettings -UserSettings $inputSettings + $result = Set-WinGetUserSetting -UserSettings $inputSettings $result | Should -Not -BeNullOrEmpty -ErrorAction Stop $result.'$schema' | Should -Not -BeNullOrEmpty @@ -620,7 +621,7 @@ Describe 'Set-WinGetUserSettings' { Set-Content -Path $settingsFilePath -Value "Hi, im not a json. Thank you, Test." $inputSettings = @{ visual= @{ progressBar="retro"} } - $result = Set-WinGetUserSettings -UserSettings $inputSettings + $result = Set-WinGetUserSetting -UserSettings $inputSettings $result | Should -Not -BeNullOrEmpty -ErrorAction Stop $result.'$schema' | Should -Not -BeNullOrEmpty @@ -631,7 +632,7 @@ Describe 'Set-WinGetUserSettings' { Set-Content -Path $settingsFilePath -Value "Hi, im not a json. Thank you, Test." $inputSettings = @{ visual= @{ progressBar="retro"} } - { Set-WinGetUserSettings -UserSettings $inputSettings -Merge } | Should -Throw + { Set-WinGetUserSetting -UserSettings $inputSettings -Merge } | Should -Throw } AfterAll { @@ -642,7 +643,7 @@ Describe 'Set-WinGetUserSettings' { Describe 'Get|Enable|Disable-WinGetSetting' { It 'Get-WinGetSetting' { - $settings = Get-WinGetSettings + $settings = Get-WinGetSetting $settings | Should -Not -BeNullOrEmpty -ErrorAction Stop $settings.'$schema' | Should -Not -BeNullOrEmpty $settings.adminSettings | Should -Not -BeNullOrEmpty @@ -651,21 +652,21 @@ Describe 'Get|Enable|Disable-WinGetSetting' { # This tests require admin It 'Enable|Disable' { - $settings = Get-WinGetSettings + $settings = Get-WinGetSetting $settings | Should -Not -BeNullOrEmpty -ErrorAction Stop $settings.adminSettings | Should -Not -BeNullOrEmpty $settings.adminSettings.LocalManifestFiles | Should -Be $false Enable-WinGetSetting -Name LocalManifestFiles - $afterEnable = Get-WinGetSettings + $afterEnable = Get-WinGetSetting $afterEnable | Should -Not -BeNullOrEmpty -ErrorAction Stop $afterEnable.adminSettings | Should -Not -BeNullOrEmpty $afterEnable.adminSettings.LocalManifestFiles | Should -Be $true Disable-WingetSetting -Name LocalManifestFiles - $afterDisable = Get-WinGetSettings + $afterDisable = Get-WinGetSetting $afterDisable | Should -Not -BeNullOrEmpty -ErrorAction Stop $afterDisable.adminSettings | Should -Not -BeNullOrEmpty $afterDisable.adminSettings.LocalManifestFiles | Should -Be $false diff --git a/src/PowerShell/tests/Microsoft.WinGet.DSC.Tests.ps1 b/src/PowerShell/tests/Microsoft.WinGet.DSC.Tests.ps1 @@ -54,7 +54,7 @@ Describe 'List available DSC resources'{ Describe 'WinGetAdminSettings' { BeforeAll { - $initialAdminSettings = (Get-WinGetSettings).adminSettings + $initialAdminSettings = (Get-WinGetSetting).adminSettings $adminSettingsHash = @{ BypassCertificatePinningForMicrosoftStore = !$initialAdminSettings.BypassCertificatePinningForMicrosoftStore; InstallerHashOverride = !$initialAdminSettings.InstallerHashOverride; @@ -100,7 +100,7 @@ Describe 'WinGetAdminSettings' { Describe 'WinGetUserSettings' { BeforeAll { # Delete existing user settings file. - $settingsFilePath = (Get-WinGetSettings).userSettingsFile + $settingsFilePath = (Get-WinGetSetting).userSettingsFile $backupSettingsFilePath = $settingsFilePath + ".backup" if (Test-Path -Path $settingsFilePath)