Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ protected override void ProcessRecord()
}
else
{
command.Assert(this.Version);
command.Assert(this.Version, this.IncludePrerelease.ToBool());
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ public abstract class WinGetPackageManagerCmdlet : PSCmdlet
/// Gets or sets a value indicating whether to include prerelease winget versions.
/// </summary>
[Parameter(
ParameterSetName = Constants.IntegrityLatestSet,
ValueFromPipelineByPropertyName = true)]
public SwitchParameter IncludePrerelease { get; set; }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ protected override void ProcessRecord()
}
else
{
this.command.Repair(this.Version, this.AllUsers.ToBool(), this.Force.ToBool());
this.command.Repair(this.Version, this.AllUsers.ToBool(), this.Force.ToBool(), this.IncludePrerelease.ToBool());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,11 @@ public void AssertUsingLatest(bool preRelease)
/// Asserts the version installed is the specified.
/// </summary>
/// <param name="expectedVersion">The expected version.</param>
public void Assert(string expectedVersion)
/// <param name="preRelease">Include prerelease versions when validating the specified version.</param>
public void Assert(string expectedVersion, bool preRelease = false)
{
// The preRelease parameter is for consistency but not used in this method
// since we're checking for an exact version match
WinGetIntegrity.AssertWinGet(this, expectedVersion);
}

Expand Down Expand Up @@ -88,12 +91,21 @@ public void RepairUsingLatest(bool preRelease, bool allUsers, bool force)
/// <param name="expectedVersion">The expected version, if any.</param>
/// <param name="allUsers">Install for all users. Requires admin.</param>
/// <param name="force">Force application shutdown.</param>
public void Repair(string expectedVersion, bool allUsers, bool force)
/// <param name="preRelease">Include prerelease versions when searching for the specified version.</param>
public void Repair(string expectedVersion, bool allUsers, bool force, bool preRelease = false)
{
this.ValidateWhenAllUsers(allUsers);
var runningTask = this.RunOnMTA(
async () =>
{
// If no specific version is provided and IncludePrerelease is specified,
// we need to get the latest prerelease version
if (string.IsNullOrEmpty(expectedVersion) && preRelease)
{
var gitHubClient = new GitHubClient(RepositoryOwner.Microsoft, RepositoryName.WinGetCli);
expectedVersion = await gitHubClient.GetLatestReleaseTagNameAsync(true);
}

await this.RepairStateMachineAsync(expectedVersion, allUsers, force);
return true;
});
Expand Down