Skip to content
Merged
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
15 changes: 8 additions & 7 deletions src/Cli/dotnet/commands/dotnet-workload/WorkloadCommandParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.

using System.CommandLine;
using System.CommandLine.Parsing;
using System.IO;
using System.Linq;
using Microsoft.Deployment.DotNet.Releases;
using Microsoft.DotNet.Cli.Utils;
using Microsoft.DotNet.Configurer;
using Microsoft.DotNet.Workloads.Workload;
using Microsoft.DotNet.Workloads.Workload.Install;
using Microsoft.DotNet.Workloads.Workload.List;
using Microsoft.NET.Sdk.WorkloadManifestReader;
using Microsoft.TemplateEngine.Cli.Commands;
Expand Down Expand Up @@ -51,9 +45,16 @@ internal static string GetWorkloadsVersion(WorkloadInfoHelper workloadInfoHelper
internal static void ShowWorkloadsInfo(ParseResult parseResult = null, WorkloadInfoHelper workloadInfoHelper = null, IReporter reporter = null, string dotnetDir = null, bool showVersion = true)
{
workloadInfoHelper ??= new WorkloadInfoHelper(parseResult != null ? parseResult.HasOption(SharedOptions.InteractiveOption) : false);
reporter ??= Utils.Reporter.Output;
var globalJsonInformation = workloadInfoHelper.ManifestProvider.GetGlobalJsonInformation();
if (globalJsonInformation?.WorkloadVersionInstalled == false)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably don't need the == false,

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

globalJsonInformation could be null, and if not, WorkloadVersionInstalled could be true or false, so this is really a bool?, hence the == false.

{
reporter.WriteLine(string.Format(Workloads.Workload.List.LocalizableStrings.WorkloadSetFromGlobalJsonNotInstalled, globalJsonInformation.GlobalJsonVersion, globalJsonInformation.GlobalJsonPath));
return;
}

IEnumerable<WorkloadId> installedList = workloadInfoHelper.InstalledSdkWorkloadIds;
InstalledWorkloadsCollection installedWorkloads = workloadInfoHelper.AddInstalledVsWorkloads(installedList);
reporter ??= Utils.Reporter.Output;
string dotnetPath = dotnetDir ?? Path.GetDirectoryName(Environment.ProcessPath);

if (showVersion)
Expand Down