diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml
index 9097e7ec72d4d63a147dcef8a1da9243f8b9c47d..e0d0e309c8071a93d5c32e68b4d4e7ab25480380 100644
--- a/eng/Version.Details.xml
+++ b/eng/Version.Details.xml
@@ -76,13 +76,13 @@
https://github.com/dotnet/llvm-project
76f334f354eb653a7b409a5319b591ea09df5a43
-
+
https://github.com/dotnet/command-line-api
- 8374d5fca634a93458c84414b1604c12f765d1ab
+ 02fe27cd6a9b001c8feb7938e6ef4b3799745759
-
+
https://github.com/dotnet/command-line-api
- 8374d5fca634a93458c84414b1604c12f765d1ab
+ 02fe27cd6a9b001c8feb7938e6ef4b3799745759b
diff --git a/eng/Versions.props b/eng/Versions.props
index 13372c13bdcb5e8fc1381bcda1b45bb9238e9d39..5f81f25b9c5a8e83645ad37d95852ddcf5cf1a5d 100644
--- a/eng/Versions.props
+++ b/eng/Versions.props
@@ -161,7 +161,7 @@
1.0.0-prerelease.23326.3
16.11.27-beta1.23180.1
- 2.0.0-beta4.22564.1
+ 2.0.0-beta4.23307.1
3.0.3
2.1.0
2.0.3
diff --git a/src/coreclr/tools/Common/CommandLineHelpers.cs b/src/coreclr/tools/Common/CommandLineHelpers.cs
index 2475d2a64213d899fd586a6199b4c40ba334dfae..205592c1c91dca3560145688cbfcf09d7d807c48 100644
--- a/src/coreclr/tools/Common/CommandLineHelpers.cs
+++ b/src/coreclr/tools/Common/CommandLineHelpers.cs
@@ -1,8 +1,8 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
+using System.CommandLine.Help;
using System.Collections.Generic;
-using System.CommandLine.Binding;
using System.CommandLine.Parsing;
using System.IO;
using System.IO.Compression;
@@ -24,11 +24,11 @@ internal static partial class Helpers
{
public const string DefaultSystemModule = "System.Private.CoreLib";
- public static Dictionary BuildPathDictionary(IReadOnlyList tokens, bool strict)
+ public static Dictionary BuildPathDictionary(IReadOnlyList tokens, bool strict)
{
Dictionary dictionary = new(StringComparer.OrdinalIgnoreCase);
- foreach (Token token in tokens)
+ foreach (CliToken token in tokens)
{
AppendExpandedPaths(dictionary, token.Value, strict);
}
@@ -36,11 +36,11 @@ internal static partial class Helpers
return dictionary;
}
- public static List BuildPathList(IReadOnlyList tokens)
+ public static List BuildPathList(IReadOnlyList tokens)
{
List paths = new();
Dictionary dictionary = new(StringComparer.OrdinalIgnoreCase);
- foreach (Token token in tokens)
+ foreach (CliToken token in tokens)
{
AppendExpandedPaths(dictionary, token.Value, false);
foreach (string file in dictionary.Values)
@@ -113,6 +113,36 @@ public static TargetArchitecture GetTargetArchitecture(string token)
}
}
+ public static CliRootCommand UseVersion(this CliRootCommand command)
+ {
+ for (int i = 0; i < command.Options.Count; i++)
+ {
+ if (command.Options[i] is VersionOption)
+ {
+ command.Options[i] = new VersionOption("--version", "-v");
+ break;
+ }
+ }
+
+ return command;
+ }
+
+ public static CliRootCommand UseExtendedHelp(this CliRootCommand command, Func>> customizer)
+ {
+ foreach (CliOption option in command.Options)
+ {
+ if (option is HelpOption helpOption)
+ {
+ HelpBuilder builder = new();
+ builder.CustomizeLayout(customizer);
+ helpOption.Action = new HelpAction { Builder = builder };
+ break;
+ }
+ }
+
+ return command;
+ }
+
public static void MakeReproPackage(string makeReproPath, string outputFilePath, string[] args, ParseResult res, IEnumerable inputOptions, IEnumerable outputOptions = null)
{
Directory.CreateDirectory(makeReproPath);
@@ -177,16 +207,16 @@ public static void MakeReproPackage(string makeReproPath, string outputFilePath,
Dictionary outputToReproPackageFileName = new();
List rspFile = new List();
- foreach (var option in res.CommandResult.Command.Options)
+ foreach (CliOption option in res.CommandResult.Command.Options)
{
- if (!res.HasOption(option) || option.Name == "make-repro-path")
+ OptionResult optionResult = res.GetResult(option);
+ if (optionResult is null || option.Name == "make-repro-path")
{
continue;
}
- IValueDescriptor descriptor = option;
- object val = res.CommandResult.GetValue(option);
- if (val is not null && !(descriptor.HasDefaultValue && descriptor.GetDefaultValue().Equals(val)))
+ object val = optionResult.GetValueOrDefault