Updates to the PowerShell modules (#4716)
This commit is contained in:
Родитель
19b3b5ee94
Коммит
8691cb362c
|
@ -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
|
||||
|
|
|
@ -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]+"\)\]
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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] [<CommonParameters>]
|
||||
Get-WinGetSetting [-AsPlainText] [<CommonParameters>]
|
||||
```
|
||||
|
||||
## 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)
|
|
@ -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 [<CommonParameters>]
|
||||
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-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)
|
|
@ -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)
|
||||
|
|
|
@ -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 <Hashtable> [-Merge] [<CommonParameters>]
|
||||
Set-WinGetUserSetting -UserSettings <Hashtable> [-Merge] [<CommonParameters>]
|
||||
```
|
||||
|
||||
## 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)
|
|
@ -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 <Hashtable> [-IgnoreNotSet] [<CommonParameters>]
|
||||
Test-WinGetUserSetting -UserSettings <Hashtable> [-IgnoreNotSet] [<CommonParameters>]
|
||||
```
|
||||
|
||||
## 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)
|
|
@ -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>
|
||||
|
|
|
@ -18,6 +18,7 @@ namespace Microsoft.WinGet.Client.Commands
|
|||
VerbsLifecycle.Assert,
|
||||
Constants.WinGetNouns.WinGetPackageManager,
|
||||
DefaultParameterSetName = Constants.IntegrityVersionSet)]
|
||||
[Alias("awgpm")]
|
||||
public class AssertWinGetPackageManagerCmdlet : WinGetPackageManagerCmdlet
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -1,34 +1,35 @@
|
|||
// -----------------------------------------------------------------------------
|
||||
// <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());
|
||||
}
|
||||
}
|
||||
}
|
||||
// -----------------------------------------------------------------------------
|
||||
// <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());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,30 +1,31 @@
|
|||
// -----------------------------------------------------------------------------
|
||||
// <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();
|
||||
}
|
||||
}
|
||||
}
|
||||
// -----------------------------------------------------------------------------
|
||||
// <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();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -1,45 +1,46 @@
|
|||
// -----------------------------------------------------------------------------
|
||||
// <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());
|
||||
}
|
||||
}
|
||||
}
|
||||
// -----------------------------------------------------------------------------
|
||||
// <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());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,44 +1,45 @@
|
|||
// -----------------------------------------------------------------------------
|
||||
// <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());
|
||||
}
|
||||
}
|
||||
}
|
||||
// -----------------------------------------------------------------------------
|
||||
// <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());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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 = @()
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
PowerShellVersion = '7.2.8'
|
||||
|
||||
FunctionsToExport = @()
|
||||
AliasesToExport = @()
|
||||
AliasesToExport = @('cmpwgc', 'cnwgc', 'ctwgcy', 'gwgc', 'gwgcd', 'iwgc', 'rwgch', 'sawgc', 'spwgc','twgc')
|
||||
|
||||
CmdletsToExport = @(
|
||||
"Complete-WinGetConfiguration"
|
||||
|
|
|
@ -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 = @{
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
Загрузка…
Ссылка в новой задаче