Skip to content

Commit

Permalink
Code review feedback and cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
dsplaisted committed Apr 4, 2024
1 parent d884497 commit 7ecfc8a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ namespace Microsoft.DotNet.Workloads.Workload.Config
{
internal class WorkloadConfigCommand : WorkloadCommandBase
{
bool _hasUpdateMode;
string? _updateMode;
readonly IWorkloadResolverFactory _workloadResolverFactory;
private bool _hasUpdateMode;
private string? _updateMode;
private readonly IWorkloadResolverFactory _workloadResolverFactory;

private string? _dotnetPath;
private string _userProfileDir;
Expand All @@ -38,7 +38,6 @@ public WorkloadConfigCommand(
IWorkloadResolverFactory? workloadResolverFactory = null
) : base(parseResult, CommonOptions.HiddenVerbosityOption, reporter)
{
// TODO: Is it possible to check the order of the options? This would allow us to print the values out in the same order they are specified on the command line
_hasUpdateMode = parseResult.HasOption(WorkloadConfigCommandParser.UpdateMode);
_updateMode = parseResult.GetValue(WorkloadConfigCommandParser.UpdateMode);

Expand All @@ -57,13 +56,15 @@ public WorkloadConfigCommand(

public override int Execute()
{
// When we support multiple configuration values, it would be nice if we could process and display them in the order they are passed.
// It seems that the parser doesn't give us a good way to do that, however
if (_hasUpdateMode)
{
if (_updateMode == WorkloadConfigCommandParser.UpdateMode_WorkloadSet)
if (WorkloadConfigCommandParser.UpdateMode_WorkloadSet.Equals(_updateMode, StringComparison.InvariantCultureIgnoreCase))
{
_workloadInstaller.UpdateInstallMode(_sdkFeatureBand, true);
}
else if (_updateMode == WorkloadConfigCommandParser.UpdateMode_Manifests)
else if (WorkloadConfigCommandParser.UpdateMode_Manifests.Equals(_updateMode, StringComparison.InvariantCultureIgnoreCase))
{
_workloadInstaller.UpdateInstallMode(_sdkFeatureBand, false);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ internal static class WorkloadConfigCommandParser
public static readonly CliOption<string> UpdateMode = new("--update-mode")
{
Description = LocalizableStrings.UpdateModeDescription,
//Hidden = true,
Arity = ArgumentArity.ZeroOrOne
};

Expand Down
20 changes: 0 additions & 20 deletions src/Tests/dotnet-MsiInstallation.Tests/WorkloadSetTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,26 +17,6 @@ public WorkloadSetTests(ITestOutputHelper log) : base(log)
{
}

// dotnet nuget add source c:\SdkTesting\WorkloadSets
// dotnet workload update --mode workloadset

// Show workload mode in dotnet workload --info


// dotnet workload update-mode set workload-set

// dotnet workload config --update-mode workload-set

// dotnet workload config update-mode
// dotnet workload config update-mode workload-set
// dotnet workload config update-mode manifests

// dotnet workload config update-band [default|release|preview|daily]

// dotnet config workload.update-mode workload-set

// dotnet setconfig --workload-update-mode workload-set

[Fact]
public void DoesNotUseWorkloadSetsByDefault()
{
Expand Down

0 comments on commit 7ecfc8a

Please sign in to comment.