diff --git a/.github/actions/spelling/expect.txt b/.github/actions/spelling/expect.txt index 9c56b34984..1ecef0b368 100644 --- 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 index e52a81ae81..04978c43ac 100644 --- 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 index 4c78a1d9a3..25e9c436e1 100644 --- 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 index d4b03f2b9e..d1dd09213f 100644 --- 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-WinGetSettings.md b/src/PowerShell/Help/Microsoft.WinGet.Client/Get-WinGetSetting.md similarity index 88% rename from src/PowerShell/Help/Microsoft.WinGet.Client/Get-WinGetSettings.md rename to src/PowerShell/Help/Microsoft.WinGet.Client/Get-WinGetSetting.md index 6c828f7b28..5f333f9b0d 100644 --- a/src/PowerShell/Help/Microsoft.WinGet.Client/Get-WinGetSettings.md +++ b/src/PowerShell/Help/Microsoft.WinGet.Client/Get-WinGetSetting.md @@ -4,10 +4,10 @@ Module Name: Microsoft.WinGet.Client ms.date: 08/01/2024 online version: schema: 2.0.0 -title: Get-WinGetSettings +title: Get-WinGetSetting --- -# Get-WinGetSettings +# Get-WinGetSetting ## SYNOPSIS Gets WinGet configuration settings. @@ -15,7 +15,7 @@ Gets WinGet configuration settings. ## SYNTAX ``` -Get-WinGetSettings [-AsPlainText] [] +Get-WinGetSetting [-AsPlainText] [] ``` ## DESCRIPTION @@ -32,7 +32,7 @@ For more information about WinGet settings, see ### Example 1 - Display the WinGet configuration settings ```powershell -Get-WinGetSettings +Get-WinGetSetting ``` ```Output @@ -47,7 +47,7 @@ adminSettings {[ProxyCommandLineOptions, False], [LocalArchiveMalwareScanOve ### Example 2 - Display the administrative settings in WinGet configuration ```powershell -Get-WinGetSettings | Select-Object -ExpandProperty adminSettings +Get-WinGetSetting | Select-Object -ExpandProperty adminSettings ``` ```Output @@ -97,6 +97,6 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## RELATED LINKS -[Get-WinGetUserSettings](Get-WinGetUserSettings.md) +[Get-WinGetUserSetting](Get-WinGetUserSetting.md) -[Set-WinGetUserSettings](Set-WinGetUserSettings.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-WinGetUserSetting.md similarity index 79% rename from src/PowerShell/Help/Microsoft.WinGet.Client/Get-WinGetUserSettings.md rename to src/PowerShell/Help/Microsoft.WinGet.Client/Get-WinGetUserSetting.md index 9c6ef88b23..6cb4ade6d3 100644 --- a/src/PowerShell/Help/Microsoft.WinGet.Client/Get-WinGetUserSettings.md +++ b/src/PowerShell/Help/Microsoft.WinGet.Client/Get-WinGetUserSetting.md @@ -4,10 +4,10 @@ Module Name: Microsoft.WinGet.Client ms.date: 08/01/2024 online version: schema: 2.0.0 -title: Get-WinGetUserSettings +title: Get-WinGetUserSetting --- -# Get-WinGetUserSettings +# Get-WinGetUserSetting ## SYNOPSIS Gets user settings for WinGet. @@ -15,21 +15,21 @@ Gets user settings for WinGet. ## SYNTAX ``` -Get-WinGetUserSettings [] +Get-WinGetUserSetting [] ``` ## 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. +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-WinGetUserSettings +Get-WinGetUserSetting ``` ## PARAMETERS @@ -53,6 +53,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/Microsoft.WinGet.Client.md b/src/PowerShell/Help/Microsoft.WinGet.Client/Microsoft.WinGet.Client.md index 44689febb5..c660a395a7 100644 --- 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-WinGetUserSettings.md b/src/PowerShell/Help/Microsoft.WinGet.Client/Set-WinGetUserSetting.md similarity index 87% rename from src/PowerShell/Help/Microsoft.WinGet.Client/Set-WinGetUserSettings.md rename to src/PowerShell/Help/Microsoft.WinGet.Client/Set-WinGetUserSetting.md index b76a7c4f4a..cba5723f38 100644 --- a/src/PowerShell/Help/Microsoft.WinGet.Client/Set-WinGetUserSettings.md +++ b/src/PowerShell/Help/Microsoft.WinGet.Client/Set-WinGetUserSetting.md @@ -4,10 +4,10 @@ Module Name: Microsoft.WinGet.Client ms.date: 08/01/2024 online version: schema: 2.0.0 -title: Set-WinGetUserSettings +title: Set-WinGetUserSetting --- -# Set-WinGetUserSettings +# Set-WinGetUserSetting ## SYNOPSIS Sets configuration settings of the WinGet client for the current user. @@ -15,7 +15,7 @@ Sets configuration settings of the WinGet client for the current user. ## SYNTAX ``` -Set-WinGetUserSettings -UserSettings [-Merge] [] +Set-WinGetUserSetting -UserSettings [-Merge] [] ``` ## DESCRIPTION @@ -31,7 +31,7 @@ For more information about WinGet settings, see ### Example 1: Set progress bar theme ```powershell -Set-WinGetUserSettings -UserSettings @{ +Set-WinGetUserSetting -UserSettings @{ visual = @{ progressBar = 'rainbow' } @@ -43,7 +43,7 @@ Sets the theme of the progress bar to rainbow. ### Example 2: Merge install behavior settings ```powershell -Set-WinGetUserSettings -Merge -UserSettings @{ +Set-WinGetUserSetting -Merge -UserSettings @{ installBehavior = @{ preferences = @{ scope = 'user' @@ -57,7 +57,7 @@ Appends the user scope preference setting to the existing WinGet settings config ### Example 3: Change multiple settings ```powershell -Set-WinGetUserSettings -UserSettings @{ +Set-WinGetUserSetting -UserSettings @{ visual = @{ progressBar = 'rainbow' anonymizeDisplayedPaths = $true @@ -121,6 +121,6 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## RELATED LINKS -[Get-WinGetUserSettings](Get-WinGetUserSettings.md) +[Get-WinGetUserSetting](Get-WinGetUserSetting.md) -[Test-WinGetUserSettings](Test-WinGetUserSettings.md) +[Test-WinGetUserSetting](Test-WinGetUserSetting.md) diff --git a/src/PowerShell/Help/Microsoft.WinGet.Client/Test-WinGetUserSettings.md b/src/PowerShell/Help/Microsoft.WinGet.Client/Test-WinGetUserSetting.md similarity index 86% rename from src/PowerShell/Help/Microsoft.WinGet.Client/Test-WinGetUserSettings.md rename to src/PowerShell/Help/Microsoft.WinGet.Client/Test-WinGetUserSetting.md index fbc0100c95..b90bebaf3f 100644 --- a/src/PowerShell/Help/Microsoft.WinGet.Client/Test-WinGetUserSettings.md +++ b/src/PowerShell/Help/Microsoft.WinGet.Client/Test-WinGetUserSetting.md @@ -4,10 +4,10 @@ Module Name: Microsoft.WinGet.Client ms.date: 08/01/2024 online version: schema: 2.0.0 -title: Test-WinGetUserSettings +title: Test-WinGetUserSetting --- -# Test-WinGetUserSettings +# Test-WinGetUserSetting ## SYNOPSIS Tests the current state of WinGet user settings. @@ -15,7 +15,7 @@ Tests the current state of WinGet user settings. ## SYNTAX ``` -Test-WinGetUserSettings -UserSettings [-IgnoreNotSet] [] +Test-WinGetUserSetting -UserSettings [-IgnoreNotSet] [] ``` ## DESCRIPTION @@ -27,7 +27,7 @@ This command tests the current state of WinGet user settings against a provided ### Example 1: Test for exact match ```powershell -Test-WinGetUserSettings -UserSettings @{ +Test-WinGetUserSetting -UserSettings @{ installBehavior = @{ preferences = @{ scope = 'user' @@ -42,7 +42,7 @@ command returns `$false` if it is not an exact match. ### Example 2: Test only progress bar setting ```powershell -Test-WinGetUserSettings -IgnoreNotSet -UserSettings @{ +Test-WinGetUserSetting -IgnoreNotSet -UserSettings @{ visual = @{ progressBar = 'rainbow' } @@ -109,6 +109,6 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## RELATED LINKS -[Get-WinGetUserSettings](Get-WinGetUserSettings.md) +[Get-WinGetUserSetting](Get-WinGetUserSetting.md) -[Set-WinGetUserSettings](Set-WinGetUserSettings.md) +[Set-WinGetUserSetting](Set-WinGetUserSetting.md) diff --git a/src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/AddSourceCmdlet.cs b/src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/AddSourceCmdlet.cs index 03a5e75793..51b00270ef 100644 --- 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. /// [Cmdlet(VerbsCommon.Add, Constants.WinGetNouns.Source)] + [Alias("awgs")] public sealed class AddSourceCmdlet : PSCmdlet { /// diff --git a/src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/AssertWinGetPackageManagerCmdlet.cs b/src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/AssertWinGetPackageManagerCmdlet.cs index 9e574e1824..b33bdbd502 100644 --- 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 { /// diff --git a/src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/DisableSettingCmdlet.cs b/src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/DisableSettingCmdlet.cs index d2d3a42aa1..2ecaea93f1 100644 --- 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. /// [Cmdlet(VerbsLifecycle.Disable, Constants.WinGetNouns.Setting)] + [Alias("dwgs")] public sealed class DisableSettingCmdlet : PSCmdlet { /// diff --git a/src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/EnableSettingCmdlet.cs b/src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/EnableSettingCmdlet.cs index 039d08415c..80590ec353 100644 --- 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. /// [Cmdlet(VerbsLifecycle.Enable, Constants.WinGetNouns.Setting)] + [Alias("ewgs")] public sealed class EnableSettingCmdlet : PSCmdlet { /// diff --git a/src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/ExportPackageCmdlet.cs b/src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/ExportPackageCmdlet.cs index ac6c6929eb..6c012f682e 100644 --- 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 (c) Microsoft Corporation. Licensed under the MIT License. -// -// ----------------------------------------------------------------------------- - -namespace Microsoft.WinGet.Client.Commands -{ +// ----------------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. Licensed under the MIT License. +// +// ----------------------------------------------------------------------------- + +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; - /// - /// Downloads a package installer from the pipeline or from a configured source. - /// - [Cmdlet( - VerbsData.Export, - Constants.WinGetNouns.Package, - DefaultParameterSetName = Constants.FoundSet, - SupportsShouldProcess = true)] - [OutputType(typeof(PSDownloadResult))] - public sealed class ExportPackageCmdlet : InstallerSelectionCmdlet - { + /// + /// Downloads a package installer from the pipeline or from a configured source. + /// + [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; /// /// Gets or sets the directory where the installer will be downloaded to. - /// - [Parameter(ValueFromPipelineByPropertyName = true)] + /// + [Parameter(ValueFromPipelineByPropertyName = true)] public string DownloadDirectory { get; set; } - /// - /// Installs a package from the pipeline or from a configured source. - /// - protected override void ProcessRecord() + /// + /// Installs a package from the pipeline or from a configured source. + /// + protected override void ProcessRecord() { this.command = new DownloadCommand( this, @@ -47,7 +48,7 @@ protected override void ProcessRecord() 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()); } /// @@ -59,6 +60,6 @@ protected override void StopProcessing() { 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 index a16ac326a6..229fbe1831 100644 --- 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 (c) Microsoft Corporation. Licensed under the MIT License. -// -// ----------------------------------------------------------------------------- - -namespace Microsoft.WinGet.Client.Commands -{ +// ----------------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. Licensed under the MIT License. +// +// ----------------------------------------------------------------------------- + +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; - - /// - /// Searches configured sources for packages. - /// - [Cmdlet(VerbsCommon.Find, Constants.WinGetNouns.Package)] - [OutputType(typeof(PSFoundCatalogPackage))] - public sealed class FindPackageCmdlet : FinderExtendedCmdlet - { - /// - /// Searches for configured sources for packages. - /// - protected override void ProcessRecord() + using Microsoft.WinGet.Client.Engine.PSObjects; + + /// + /// Searches configured sources for packages. + /// + [Cmdlet(VerbsCommon.Find, Constants.WinGetNouns.Package)] + [Alias("fdwgp")] + [OutputType(typeof(PSFoundCatalogPackage))] + public sealed class FindPackageCmdlet : FinderExtendedCmdlet + { + /// + /// Searches for configured sources for packages. + /// + protected override void ProcessRecord() { var command = new FinderPackageCommand( this, @@ -35,7 +36,7 @@ protected override void ProcessRecord() 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 index 01fab7ccdd..9338faba32 100644 --- 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. /// [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/GetSettingsCmdlet.cs b/src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/GetSettingCmdlet.cs similarity index 75% rename from src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/GetSettingsCmdlet.cs rename to src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/GetSettingCmdlet.cs index 6aacade5a2..39067d11d1 100644 --- a/src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/GetSettingsCmdlet.cs +++ b/src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/GetSettingCmdlet.cs @@ -1,34 +1,35 @@ -// ----------------------------------------------------------------------------- -// -// Copyright (c) Microsoft Corporation. Licensed under the MIT License. -// -// ----------------------------------------------------------------------------- - -namespace Microsoft.WinGet.Client.Cmdlets.Cmdlets -{ - using System.Management.Automation; - using Microsoft.WinGet.Client.Common; - using Microsoft.WinGet.Client.Engine.Commands; - - /// - /// Gets winget settings. - /// - [Cmdlet(VerbsCommon.Get, Constants.WinGetNouns.Settings)] - public sealed class GetSettingsCmdlet : PSCmdlet - { - /// - /// Gets or sets a value indicating whether to output a string or a hashtable. - /// - [Parameter(ValueFromPipelineByPropertyName = true)] - public SwitchParameter AsPlainText { get; set; } - - /// - /// Get settings. - /// - protected override void ProcessRecord() - { - var command = new CliCommand(this); - command.GetSettings(this.AsPlainText.ToBool()); - } - } -} +// ----------------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. Licensed under the MIT License. +// +// ----------------------------------------------------------------------------- + +namespace Microsoft.WinGet.Client.Cmdlets.Cmdlets +{ + using System.Management.Automation; + using Microsoft.WinGet.Client.Common; + using Microsoft.WinGet.Client.Engine.Commands; + + /// + /// Gets winget settings. + /// + [Cmdlet(VerbsCommon.Get, Constants.WinGetNouns.Setting)] + [Alias("gwgse", "Get-WinGetSettings")] + public sealed class GetSettingCmdlet : PSCmdlet + { + /// + /// Gets or sets a value indicating whether to output a string or a hashtable. + /// + [Parameter(ValueFromPipelineByPropertyName = true)] + public SwitchParameter AsPlainText { get; set; } + + /// + /// Get settings. + /// + 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 index 4674456dfc..f19ee12f6a 100644 --- 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 (c) Microsoft Corporation. Licensed under the MIT License. -// -// ----------------------------------------------------------------------------- - -namespace Microsoft.WinGet.Client.Commands -{ - using System.Management.Automation; +// ----------------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. Licensed under the MIT License. +// +// ----------------------------------------------------------------------------- + +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; - /// - /// Retrieves the list of configured sources. - /// - [Cmdlet(VerbsCommon.Get, Constants.WinGetNouns.Source)] - [OutputType(typeof(PSSourceResult))] - public sealed class GetSourceCmdlet : PSCmdlet - { - /// - /// Gets or sets the name of the source to retrieve. - /// - [Parameter( - Position = 0, - ValueFromPipeline = true, - ValueFromPipelineByPropertyName = true)] - public string Name { get; set; } - - /// - /// Returns the list of configured sources. - /// - protected override void ProcessRecord() - { - var command = new SourceCommand(this); - command.Get(this.Name); - } - } -} + /// + /// Retrieves the list of configured sources. + /// + [Cmdlet(VerbsCommon.Get, Constants.WinGetNouns.Source)] + [Alias("gwgso")] + [OutputType(typeof(PSSourceResult))] + public sealed class GetSourceCmdlet : PSCmdlet + { + /// + /// Gets or sets the name of the source to retrieve. + /// + [Parameter( + Position = 0, + ValueFromPipeline = true, + ValueFromPipelineByPropertyName = true)] + public string Name { get; set; } + + /// + /// Returns the list of configured sources. + /// + protected override void ProcessRecord() + { + var command = new SourceCommand(this); + command.Get(this.Name); + } + } +} diff --git a/src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/GetUserSettingsCmdlet.cs b/src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/GetUserSettingCmdlet.cs similarity index 77% rename from src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/GetUserSettingsCmdlet.cs rename to src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/GetUserSettingCmdlet.cs index 200ef1b8b6..fe9dcdefef 100644 --- a/src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/GetUserSettingsCmdlet.cs +++ b/src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/GetUserSettingCmdlet.cs @@ -1,30 +1,31 @@ -// ----------------------------------------------------------------------------- -// -// Copyright (c) Microsoft Corporation. Licensed under the MIT License. -// -// ----------------------------------------------------------------------------- - -namespace Microsoft.WinGet.Client.Commands -{ - using System.Collections; - using System.Management.Automation; - using Microsoft.WinGet.Client.Common; - using Microsoft.WinGet.Client.Engine.Commands; - - /// - /// Gets winget's user settings. - /// - [Cmdlet(VerbsCommon.Get, Constants.WinGetNouns.UserSettings)] - [OutputType(typeof(Hashtable))] - public sealed class GetUserSettingsCmdlet : PSCmdlet - { - /// - /// Gets the settings file contents. - /// - protected override void ProcessRecord() - { - var command = new UserSettingsCommand(this); - command.Get(); - } - } -} +// ----------------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. Licensed under the MIT License. +// +// ----------------------------------------------------------------------------- + +namespace Microsoft.WinGet.Client.Commands +{ + using System.Collections; + using System.Management.Automation; + using Microsoft.WinGet.Client.Common; + using Microsoft.WinGet.Client.Engine.Commands; + + /// + /// Gets winget's user settings. + /// + [Cmdlet(VerbsCommon.Get, Constants.WinGetNouns.UserSetting)] + [Alias("gwgus", "Get-WinGetUserSettings")] + [OutputType(typeof(Hashtable))] + public sealed class GetUserSettingCmdlet : PSCmdlet + { + /// + /// Gets the settings file contents. + /// + 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 index 89c32e5ce7..c15cdbe5d2 100644 --- 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. /// [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 index b5d07718ed..968319e891 100644 --- 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 index 863620a7cb..cf30a7d016 100644 --- 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. /// [Cmdlet(VerbsCommon.Remove, Constants.WinGetNouns.Source)] + [Alias("rwgs")] public sealed class RemoveSourceCmdlet : PSCmdlet { /// diff --git a/src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/RepairWinGetPackageManagerCmdlet.cs b/src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/RepairWinGetPackageManagerCmdlet.cs index 71b8a0f7a9..b3e6ae4df2 100644 --- 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 index be667df2f8..1dfdcee6ad 100644 --- 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. /// [Cmdlet(VerbsCommon.Reset, Constants.WinGetNouns.Source, DefaultParameterSetName = Constants.DefaultSet)] + [Alias("rswgs")] public sealed class ResetSourceCmdlet : PSCmdlet { /// diff --git a/src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/SetUserSettingsCmdlet.cs b/src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/SetUserSettingCmdlet.cs similarity index 86% rename from src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/SetUserSettingsCmdlet.cs rename to src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/SetUserSettingCmdlet.cs index 0a3f8e9178..12a0764dff 100644 --- a/src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/SetUserSettingsCmdlet.cs +++ b/src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/SetUserSettingCmdlet.cs @@ -1,45 +1,46 @@ -// ----------------------------------------------------------------------------- -// -// Copyright (c) Microsoft Corporation. Licensed under the MIT License. -// -// ----------------------------------------------------------------------------- - -namespace Microsoft.WinGet.Client.Commands -{ - using System.Collections; - using System.Management.Automation; - using Microsoft.WinGet.Client.Common; - using Microsoft.WinGet.Client.Engine.Commands; - - /// - /// 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. - /// - [Cmdlet(VerbsCommon.Set, Constants.WinGetNouns.UserSettings)] - [OutputType(typeof(Hashtable))] - public sealed class SetUserSettingsCmdlet : PSCmdlet - { - /// - /// Gets or sets the input user settings. - /// - [Parameter( - Mandatory = true, - ValueFromPipelineByPropertyName = true)] - public Hashtable UserSettings { get; set; } - - /// - /// Gets or sets a value indicating whether to merge the current user settings and the input settings. - /// - [Parameter(ValueFromPipelineByPropertyName = true)] - public SwitchParameter Merge { get; set; } - - /// - /// Process input of cmdlet. - /// - protected override void ProcessRecord() - { - var command = new UserSettingsCommand(this); - command.Set(this.UserSettings, this.Merge.ToBool()); - } - } -} +// ----------------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. Licensed under the MIT License. +// +// ----------------------------------------------------------------------------- + +namespace Microsoft.WinGet.Client.Commands +{ + using System.Collections; + using System.Management.Automation; + using Microsoft.WinGet.Client.Common; + using Microsoft.WinGet.Client.Engine.Commands; + + /// + /// 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. + /// + [Cmdlet(VerbsCommon.Set, Constants.WinGetNouns.UserSetting)] + [Alias("swgus", "Set-WinGetUserSettings")] + [OutputType(typeof(Hashtable))] + public sealed class SetUserSettingCmdlet : PSCmdlet + { + /// + /// Gets or sets the input user settings. + /// + [Parameter( + Mandatory = true, + ValueFromPipelineByPropertyName = true)] + public Hashtable UserSettings { get; set; } + + /// + /// Gets or sets a value indicating whether to merge the current user settings and the input settings. + /// + [Parameter(ValueFromPipelineByPropertyName = true)] + public SwitchParameter Merge { get; set; } + + /// + /// Process input of cmdlet. + /// + 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/TestUserSettingsCmdlet.cs b/src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/TestUserSettingCmdlet.cs similarity index 88% rename from src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/TestUserSettingsCmdlet.cs rename to src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/TestUserSettingCmdlet.cs index d938ff9312..8a9bf4910f 100644 --- a/src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/TestUserSettingsCmdlet.cs +++ b/src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/TestUserSettingCmdlet.cs @@ -1,44 +1,45 @@ -// ----------------------------------------------------------------------------- -// -// Copyright (c) Microsoft Corporation. Licensed under the MIT License. -// -// ----------------------------------------------------------------------------- - -namespace Microsoft.WinGet.Client.Commands -{ - using System.Collections; - using System.Management.Automation; - using Microsoft.WinGet.Client.Common; - using Microsoft.WinGet.Client.Engine.Commands; - - /// - /// Compare the specified user settings with the winget user settings. - /// - [Cmdlet(VerbsDiagnostic.Test, Constants.WinGetNouns.UserSettings)] - [OutputType(typeof(bool))] - public sealed class TestUserSettingsCmdlet : PSCmdlet - { - /// - /// Gets or sets the input user settings. - /// - [Parameter( - Mandatory = true, - ValueFromPipelineByPropertyName = true)] - public Hashtable UserSettings { get; set; } - - /// - /// Gets or sets a value indicating whether to ignore comparing settings that are not part of the input. - /// - [Parameter(ValueFromPipelineByPropertyName = true)] - public SwitchParameter IgnoreNotSet { get; set; } - - /// - /// Process the cmdlet and writes the result of the comparison. - /// - protected override void ProcessRecord() - { - var command = new UserSettingsCommand(this); - command.Test(this.UserSettings, this.IgnoreNotSet.ToBool()); - } - } -} +// ----------------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. Licensed under the MIT License. +// +// ----------------------------------------------------------------------------- + +namespace Microsoft.WinGet.Client.Commands +{ + using System.Collections; + using System.Management.Automation; + using Microsoft.WinGet.Client.Common; + using Microsoft.WinGet.Client.Engine.Commands; + + /// + /// Compare the specified user settings with the winget user settings. + /// + [Cmdlet(VerbsDiagnostic.Test, Constants.WinGetNouns.UserSetting)] + [Alias("twgus", "Test-WinGetUserSettings")] + [OutputType(typeof(bool))] + public sealed class TestUserSettingCmdlet : PSCmdlet + { + /// + /// Gets or sets the input user settings. + /// + [Parameter( + Mandatory = true, + ValueFromPipelineByPropertyName = true)] + public Hashtable UserSettings { get; set; } + + /// + /// Gets or sets a value indicating whether to ignore comparing settings that are not part of the input. + /// + [Parameter(ValueFromPipelineByPropertyName = true)] + public SwitchParameter IgnoreNotSet { get; set; } + + /// + /// Process the cmdlet and writes the result of the comparison. + /// + 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 index f2b93beecf..46518a7d2d 100644 --- 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 (c) Microsoft Corporation. Licensed under the MIT License. -// -// ----------------------------------------------------------------------------- - -namespace Microsoft.WinGet.Client.Commands -{ +// ----------------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. Licensed under the MIT License. +// +// ----------------------------------------------------------------------------- + +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; - /// - /// Uninstalls a package from the local system. - /// - [Cmdlet( - VerbsLifecycle.Uninstall, - Constants.WinGetNouns.Package, - DefaultParameterSetName = Constants.FoundSet, - SupportsShouldProcess = true)] - [OutputType(typeof(PSUninstallResult))] - public sealed class UninstallPackageCmdlet : PackageCmdlet - { - private UninstallPackageCommand command = null; - - /// - /// Gets or sets the desired mode for the uninstallation process. - /// - [Parameter(ValueFromPipelineByPropertyName = true)] - public PSPackageUninstallMode Mode { get; set; } = PSPackageUninstallMode.Default; - - /// - /// Gets or sets a value indicating whether to continue upon non security related failures. - /// - [Parameter(ValueFromPipelineByPropertyName = true)] + /// + /// Uninstalls a package from the local system. + /// + [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; + + /// + /// Gets or sets the desired mode for the uninstallation process. + /// + [Parameter(ValueFromPipelineByPropertyName = true)] + public PSPackageUninstallMode Mode { get; set; } = PSPackageUninstallMode.Default; + + /// + /// Gets or sets a value indicating whether to continue upon non security related failures. + /// + [Parameter(ValueFromPipelineByPropertyName = true)] public SwitchParameter Force { get; set; } - /// - /// Gets or sets the path to the logging file. - /// - [Parameter(ValueFromPipelineByPropertyName = true)] - public string Log { get; set; } - - /// - /// Uninstalls a package from the local system. - /// - protected override void ProcessRecord() + /// + /// Gets or sets the path to the logging file. + /// + [Parameter(ValueFromPipelineByPropertyName = true)] + public string Log { get; set; } + + /// + /// Uninstalls a package from the local system. + /// + protected override void ProcessRecord() { this.command = new UninstallPackageCommand( this, @@ -59,7 +60,7 @@ protected override void ProcessRecord() 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()); } /// @@ -71,6 +72,6 @@ protected override void StopProcessing() { 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 index 2dcc785975..bdcf9832d3 100644 --- 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 (c) Microsoft Corporation. Licensed under the MIT License. -// -// ----------------------------------------------------------------------------- - -namespace Microsoft.WinGet.Client.Commands -{ +// ----------------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. Licensed under the MIT License. +// +// ----------------------------------------------------------------------------- + +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; - /// - /// This commands updates a package from the pipeline or from the local system. - /// - [Cmdlet( - VerbsData.Update, - Constants.WinGetNouns.Package, - DefaultParameterSetName = Constants.FoundSet, - SupportsShouldProcess = true)] - [OutputType(typeof(PSInstallResult))] - public sealed class UpdatePackageCmdlet : InstallCmdlet - { - /// - /// Gets or sets a value indicating whether updating to an unknown version is allowed. - /// - [Parameter(ValueFromPipelineByPropertyName = true)] - public SwitchParameter IncludeUnknown { get; set; } - - /// - /// Updates a package from the pipeline or from the local system. - /// - protected override void ProcessRecord() + /// + /// This commands updates a package from the pipeline or from the local system. + /// + [Cmdlet( + VerbsData.Update, + Constants.WinGetNouns.Package, + DefaultParameterSetName = Constants.FoundSet, + SupportsShouldProcess = true)] + [Alias("udwgp")] + [OutputType(typeof(PSInstallResult))] + public sealed class UpdatePackageCmdlet : InstallCmdlet + { + /// + /// Gets or sets a value indicating whether updating to an unknown version is allowed. + /// + [Parameter(ValueFromPipelineByPropertyName = true)] + public SwitchParameter IncludeUnknown { get; set; } + + /// + /// Updates a package from the pipeline or from the local system. + /// + protected override void ProcessRecord() { var command = new InstallerPackageCommand( this, @@ -51,7 +52,7 @@ protected override void ProcessRecord() 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 index 0f403a512f..62847c6567 100644 --- a/src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Common/Constants.cs +++ b/src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Common/Constants.cs @@ -75,22 +75,17 @@ public static class WinGetNouns /// /// The noun for any user settings cmdlet. /// - public const string UserSettings = "WinGetUserSettings"; + public const string UserSetting = "WinGetUserSetting"; /// /// The noun for winget version. /// public const string Version = "WinGetVersion"; - /// - /// The noun for enable/disable winget admin settings. + /// + /// The noun for enable/disable winget admin settings. /// public const string Setting = "WinGetSetting"; - - /// - /// The noun to get the winget settings. - /// - 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 index 0c82256120..64433e0b6c 100644 --- a/src/PowerShell/Microsoft.WinGet.Client.Engine/Commands/UserSettingsCommand.cs +++ b/src/PowerShell/Microsoft.WinGet.Client.Engine/Commands/UserSettingsCommand.cs @@ -51,7 +51,7 @@ public UserSettingsCommand(PSCmdlet psCmdlet) } /// - /// Get-WinGetUserSettings. + /// Get-WinGetUserSetting. /// public void Get() { @@ -59,7 +59,7 @@ public void Get() } /// - /// Test-WinGetUserSettings. + /// Test-WinGetUserSetting. /// /// Input user settings. /// Ignore comparing settings that are not part of the input. @@ -69,7 +69,7 @@ public void Test(Hashtable userSettings, bool ignoreNotSet) } /// - /// Set-WinGetUserSettings. + /// Set-WinGetUserSetting. /// /// Input user settings. /// Merge the current user settings and the input settings. diff --git a/src/PowerShell/Microsoft.WinGet.Client/ModuleFiles/Microsoft.WinGet.Client.psd1 b/src/PowerShell/Microsoft.WinGet.Client/ModuleFiles/Microsoft.WinGet.Client.psd1 index c0f3786ee1..852e6aec8d 100644 --- 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 index 538afd1814..00f3d4ece3 100644 --- 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 index e647279413..2fdb31c849 100644 --- 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. /// [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 index d7b5fb2147..72df06d19a 100644 --- 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. /// [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 index fbe0d65804..615075190d 100644 --- 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. /// [Cmdlet(VerbsData.ConvertTo, "WinGetConfigurationYaml")] + [Alias("ctwgcy")] public sealed class ConvertToWinGetConfigurationYamlCmdlet : PSCmdlet { /// diff --git a/src/PowerShell/Microsoft.WinGet.Configuration.Cmdlets/Cmdlets/GetWinGetConfigurationCmdlet.cs b/src/PowerShell/Microsoft.WinGet.Configuration.Cmdlets/Cmdlets/GetWinGetConfigurationCmdlet.cs index 03cf4162a9..39f9a914a0 100644 --- 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. /// [Cmdlet(VerbsCommon.Get, "WinGetConfiguration", DefaultParameterSetName = Helpers.Constants.ParameterSet.OpenConfigurationSetFromFile)] + [Alias("gwgc")] public sealed class GetWinGetConfigurationCmdlet : OpenConfiguration { /// diff --git a/src/PowerShell/Microsoft.WinGet.Configuration.Cmdlets/Cmdlets/GetWinGetConfigurationDetailsCmdlet.cs b/src/PowerShell/Microsoft.WinGet.Configuration.Cmdlets/Cmdlets/GetWinGetConfigurationDetailsCmdlet.cs index ec4b94fe82..a567637210 100644 --- 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. /// [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 index b22f07eb4b..1db374fea2 100644 --- 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. /// [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 index 5d12307af0..7f69b91aaa 100644 --- 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. /// [Cmdlet(VerbsCommon.Remove, "WinGetConfigurationHistory")] + [Alias("rwgch")] public sealed class RemoveWinGetConfigurationHistoryCmdlet : PSCmdlet { /// diff --git a/src/PowerShell/Microsoft.WinGet.Configuration.Cmdlets/Cmdlets/StartWinGetConfigurationCmdlet.cs b/src/PowerShell/Microsoft.WinGet.Configuration.Cmdlets/Cmdlets/StartWinGetConfigurationCmdlet.cs index 2e40575611..494cfc66d7 100644 --- 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. /// [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 index 5b59cc44f0..da367b4fa2 100644 --- 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. /// [Cmdlet(VerbsLifecycle.Stop, "WinGetConfiguration")] + [Alias("spwgc")] public sealed class StopWinGetConfigurationCmdlet : PSCmdlet { /// diff --git a/src/PowerShell/Microsoft.WinGet.Configuration.Cmdlets/Cmdlets/TestWinGetConfigurationCmdlet.cs b/src/PowerShell/Microsoft.WinGet.Configuration.Cmdlets/Cmdlets/TestWinGetConfigurationCmdlet.cs index 8aaab94f15..772c132320 100644 --- 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. /// [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 index c6a0a016fd..299a0123b9 100644 --- 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 index f6e7602a2b..749cc9d608 100644 --- 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 index b48f9b31c6..cc08e83906 100644 --- 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 index 9c78a64dfc..e17ff6a764 100644 --- 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)