Skip to content

Commit e40bceb

Browse files
committed
crlf
1 parent 4879287 commit e40bceb

4 files changed

Lines changed: 396 additions & 396 deletions

File tree

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,41 @@
1-
// -----------------------------------------------------------------------------
2-
// <copyright file="AssertWinGetPackageManagerCmdlet.cs" company="Microsoft Corporation">
3-
// Copyright (c) Microsoft Corporation. Licensed under the MIT License.
4-
// </copyright>
5-
// -----------------------------------------------------------------------------
6-
7-
namespace Microsoft.WinGet.Client.Commands
8-
{
9-
using System.Management.Automation;
10-
using Microsoft.WinGet.Client.Commands.Common;
11-
using Microsoft.WinGet.Client.Common;
12-
using Microsoft.WinGet.Client.Engine.Commands;
13-
14-
/// <summary>
15-
/// Assert-WinGetPackageManager. Verifies winget is installed properly.
16-
/// </summary>
17-
[Cmdlet(
18-
VerbsLifecycle.Assert,
19-
Constants.WinGetNouns.WinGetPackageManager,
20-
DefaultParameterSetName = Constants.IntegrityVersionSet)]
21-
[Alias("awgpm")]
22-
public class AssertWinGetPackageManagerCmdlet : WinGetPackageManagerCmdlet
23-
{
24-
/// <summary>
25-
/// Validates winget is installed correctly. If not, throws an exception
26-
/// with the reason why, if any.
27-
/// </summary>
28-
protected override void ProcessRecord()
29-
{
30-
var command = new WinGetPackageManagerCommand(this);
31-
if (this.ParameterSetName == Constants.IntegrityLatestSet)
32-
{
33-
command.AssertUsingLatest(this.IncludePrerelease.ToBool());
34-
}
35-
else
36-
{
37-
command.Assert(this.Version, this.IncludePrerelease.ToBool());
38-
}
39-
}
40-
}
41-
}
1+
// -----------------------------------------------------------------------------
2+
// <copyright file="AssertWinGetPackageManagerCmdlet.cs" company="Microsoft Corporation">
3+
// Copyright (c) Microsoft Corporation. Licensed under the MIT License.
4+
// </copyright>
5+
// -----------------------------------------------------------------------------
6+
7+
namespace Microsoft.WinGet.Client.Commands
8+
{
9+
using System.Management.Automation;
10+
using Microsoft.WinGet.Client.Commands.Common;
11+
using Microsoft.WinGet.Client.Common;
12+
using Microsoft.WinGet.Client.Engine.Commands;
13+
14+
/// <summary>
15+
/// Assert-WinGetPackageManager. Verifies winget is installed properly.
16+
/// </summary>
17+
[Cmdlet(
18+
VerbsLifecycle.Assert,
19+
Constants.WinGetNouns.WinGetPackageManager,
20+
DefaultParameterSetName = Constants.IntegrityVersionSet)]
21+
[Alias("awgpm")]
22+
public class AssertWinGetPackageManagerCmdlet : WinGetPackageManagerCmdlet
23+
{
24+
/// <summary>
25+
/// Validates winget is installed correctly. If not, throws an exception
26+
/// with the reason why, if any.
27+
/// </summary>
28+
protected override void ProcessRecord()
29+
{
30+
var command = new WinGetPackageManagerCommand(this);
31+
if (this.ParameterSetName == Constants.IntegrityLatestSet)
32+
{
33+
command.AssertUsingLatest(this.IncludePrerelease.ToBool());
34+
}
35+
else
36+
{
37+
command.Assert(this.Version, this.IncludePrerelease.ToBool());
38+
}
39+
}
40+
}
41+
}
Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,40 @@
1-
// -----------------------------------------------------------------------------
2-
// <copyright file="WinGetPackageManagerCmdlet.cs" company="Microsoft Corporation">
3-
// Copyright (c) Microsoft Corporation. Licensed under the MIT License.
4-
// </copyright>
5-
// -----------------------------------------------------------------------------
6-
7-
namespace Microsoft.WinGet.Client.Commands.Common
8-
{
9-
using System.Management.Automation;
10-
using Microsoft.WinGet.Client.Common;
11-
12-
/// <summary>
13-
/// Common parameters for Assert-WinGetPackageManager and Repair-WinGetPackageManager.
14-
/// </summary>
15-
public abstract class WinGetPackageManagerCmdlet : PSCmdlet
16-
{
17-
/// <summary>
18-
/// Gets or sets the optional version.
19-
/// </summary>
20-
[Parameter(
21-
ParameterSetName = Constants.IntegrityVersionSet,
22-
ValueFromPipelineByPropertyName = true)]
23-
public string Version { get; set; } = string.Empty;
24-
25-
/// <summary>
26-
/// Gets or sets a value indicating whether to use latest.
27-
/// </summary>
28-
[Parameter(
29-
ParameterSetName = Constants.IntegrityLatestSet,
30-
ValueFromPipelineByPropertyName = true)]
31-
public SwitchParameter Latest { get; set; }
32-
33-
/// <summary>
34-
/// Gets or sets a value indicating whether to include prerelease winget versions.
35-
/// </summary>
36-
[Parameter(
37-
ValueFromPipelineByPropertyName = true)]
38-
public SwitchParameter IncludePrerelease { get; set; }
39-
}
40-
}
1+
// -----------------------------------------------------------------------------
2+
// <copyright file="WinGetPackageManagerCmdlet.cs" company="Microsoft Corporation">
3+
// Copyright (c) Microsoft Corporation. Licensed under the MIT License.
4+
// </copyright>
5+
// -----------------------------------------------------------------------------
6+
7+
namespace Microsoft.WinGet.Client.Commands.Common
8+
{
9+
using System.Management.Automation;
10+
using Microsoft.WinGet.Client.Common;
11+
12+
/// <summary>
13+
/// Common parameters for Assert-WinGetPackageManager and Repair-WinGetPackageManager.
14+
/// </summary>
15+
public abstract class WinGetPackageManagerCmdlet : PSCmdlet
16+
{
17+
/// <summary>
18+
/// Gets or sets the optional version.
19+
/// </summary>
20+
[Parameter(
21+
ParameterSetName = Constants.IntegrityVersionSet,
22+
ValueFromPipelineByPropertyName = true)]
23+
public string Version { get; set; } = string.Empty;
24+
25+
/// <summary>
26+
/// Gets or sets a value indicating whether to use latest.
27+
/// </summary>
28+
[Parameter(
29+
ParameterSetName = Constants.IntegrityLatestSet,
30+
ValueFromPipelineByPropertyName = true)]
31+
public SwitchParameter Latest { get; set; }
32+
33+
/// <summary>
34+
/// Gets or sets a value indicating whether to include prerelease winget versions.
35+
/// </summary>
36+
[Parameter(
37+
ValueFromPipelineByPropertyName = true)]
38+
public SwitchParameter IncludePrerelease { get; set; }
39+
}
40+
}
Lines changed: 67 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,67 @@
1-
// -----------------------------------------------------------------------------
2-
// <copyright file="RepairWinGetPackageManagerCmdlet.cs" company="Microsoft Corporation">
3-
// Copyright (c) Microsoft Corporation. Licensed under the MIT License.
4-
// </copyright>
5-
// -----------------------------------------------------------------------------
6-
7-
namespace Microsoft.WinGet.Client.Commands
8-
{
9-
using System.Management.Automation;
10-
using Microsoft.WinGet.Client.Commands.Common;
11-
using Microsoft.WinGet.Client.Common;
12-
using Microsoft.WinGet.Client.Engine.Commands;
13-
14-
/// <summary>
15-
/// Repair-WinGetPackageManager. Repairs winget if needed.
16-
/// </summary>
17-
[Cmdlet(
18-
VerbsDiagnostic.Repair,
19-
Constants.WinGetNouns.WinGetPackageManager,
20-
DefaultParameterSetName = Constants.IntegrityVersionSet)]
21-
[Alias("rpwgpm")]
22-
[OutputType(typeof(int))]
23-
public class RepairWinGetPackageManagerCmdlet : WinGetPackageManagerCmdlet
24-
{
25-
private WinGetPackageManagerCommand command = null;
26-
27-
/// <summary>
28-
/// Gets or sets a value indicating whether to repair for all users. Requires admin.
29-
/// </summary>
30-
[Parameter(ValueFromPipelineByPropertyName = true)]
31-
public SwitchParameter AllUsers { get; set; }
32-
33-
/// <summary>
34-
/// Gets or sets a value indicating whether to force application shutdown.
35-
/// </summary>
36-
[Parameter(ValueFromPipelineByPropertyName = true)]
37-
public SwitchParameter Force { get; set; }
38-
39-
/// <summary>
40-
/// Attempts to repair winget.
41-
/// TODO: consider WhatIf and Confirm options.
42-
/// </summary>
43-
protected override void ProcessRecord()
44-
{
45-
this.command = new WinGetPackageManagerCommand(this);
46-
if (this.ParameterSetName == Constants.IntegrityLatestSet)
47-
{
48-
this.command.RepairUsingLatest(this.IncludePrerelease.ToBool(), this.AllUsers.ToBool(), this.Force.ToBool());
49-
}
50-
else
51-
{
52-
this.command.Repair(this.Version, this.AllUsers.ToBool(), this.Force.ToBool(), this.IncludePrerelease.ToBool());
53-
}
54-
}
55-
56-
/// <summary>
57-
/// Interrupts currently running code within the command.
58-
/// </summary>
59-
protected override void StopProcessing()
60-
{
61-
if (this.command != null)
62-
{
63-
this.command.Cancel();
64-
}
65-
}
66-
}
67-
}
1+
// -----------------------------------------------------------------------------
2+
// <copyright file="RepairWinGetPackageManagerCmdlet.cs" company="Microsoft Corporation">
3+
// Copyright (c) Microsoft Corporation. Licensed under the MIT License.
4+
// </copyright>
5+
// -----------------------------------------------------------------------------
6+
7+
namespace Microsoft.WinGet.Client.Commands
8+
{
9+
using System.Management.Automation;
10+
using Microsoft.WinGet.Client.Commands.Common;
11+
using Microsoft.WinGet.Client.Common;
12+
using Microsoft.WinGet.Client.Engine.Commands;
13+
14+
/// <summary>
15+
/// Repair-WinGetPackageManager. Repairs winget if needed.
16+
/// </summary>
17+
[Cmdlet(
18+
VerbsDiagnostic.Repair,
19+
Constants.WinGetNouns.WinGetPackageManager,
20+
DefaultParameterSetName = Constants.IntegrityVersionSet)]
21+
[Alias("rpwgpm")]
22+
[OutputType(typeof(int))]
23+
public class RepairWinGetPackageManagerCmdlet : WinGetPackageManagerCmdlet
24+
{
25+
private WinGetPackageManagerCommand command = null;
26+
27+
/// <summary>
28+
/// Gets or sets a value indicating whether to repair for all users. Requires admin.
29+
/// </summary>
30+
[Parameter(ValueFromPipelineByPropertyName = true)]
31+
public SwitchParameter AllUsers { get; set; }
32+
33+
/// <summary>
34+
/// Gets or sets a value indicating whether to force application shutdown.
35+
/// </summary>
36+
[Parameter(ValueFromPipelineByPropertyName = true)]
37+
public SwitchParameter Force { get; set; }
38+
39+
/// <summary>
40+
/// Attempts to repair winget.
41+
/// TODO: consider WhatIf and Confirm options.
42+
/// </summary>
43+
protected override void ProcessRecord()
44+
{
45+
this.command = new WinGetPackageManagerCommand(this);
46+
if (this.ParameterSetName == Constants.IntegrityLatestSet)
47+
{
48+
this.command.RepairUsingLatest(this.IncludePrerelease.ToBool(), this.AllUsers.ToBool(), this.Force.ToBool());
49+
}
50+
else
51+
{
52+
this.command.Repair(this.Version, this.AllUsers.ToBool(), this.Force.ToBool(), this.IncludePrerelease.ToBool());
53+
}
54+
}
55+
56+
/// <summary>
57+
/// Interrupts currently running code within the command.
58+
/// </summary>
59+
protected override void StopProcessing()
60+
{
61+
if (this.command != null)
62+
{
63+
this.command.Cancel();
64+
}
65+
}
66+
}
67+
}

0 commit comments

Comments
 (0)