Skip to content

[BLOCKED] System.CommandLine update #46241

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 8 commits into from
68 changes: 34 additions & 34 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
Expand Up @@ -437,13 +437,13 @@
<Sha>8fe7aeb135c64e095f43292c427453858d937184</Sha>
<SourceBuild RepoName="roslyn-analyzers" ManagedOnly="true" />
</Dependency>
<Dependency Name="System.CommandLine" Version="2.0.0-beta4.25071.2">
<Dependency Name="System.CommandLine" Version="2.0.0-beta4.25072.1">
<Uri>https://github.com/dotnet/command-line-api</Uri>
<Sha>3bbb940ceeb3254790899d751a8d418348563d40</Sha>
<Sha>060374e56c1b2e741b6525ca8417006efb54fbd7</Sha>
</Dependency>
<Dependency Name="System.CommandLine.Rendering" Version="0.4.0-alpha.25071.2">
<Dependency Name="System.CommandLine.Rendering" Version="0.4.0-alpha.25072.1">
<Uri>https://github.com/dotnet/command-line-api</Uri>
<Sha>3bbb940ceeb3254790899d751a8d418348563d40</Sha>
<Sha>060374e56c1b2e741b6525ca8417006efb54fbd7</Sha>
</Dependency>
<!-- Microsoft.CodeAnalysis.Workspaces.MSBuild transitively references M.Bcl.AsyncInterfaces.
Adding an explicit dependency to make sure the latest version is used instead of the SBRP
Expand All @@ -454,9 +454,9 @@
<Sha>ff1852196a042a124267a6e599d12da20d7ff65a</Sha>
</Dependency>
<!-- Intermediate is necessary for source build. -->
<Dependency Name="Microsoft.SourceBuild.Intermediate.command-line-api" Version="0.1.607102">
<Dependency Name="Microsoft.SourceBuild.Intermediate.command-line-api" Version="0.1.607201">
<Uri>https://github.com/dotnet/command-line-api</Uri>
<Sha>3bbb940ceeb3254790899d751a8d418348563d40</Sha>
<Sha>060374e56c1b2e741b6525ca8417006efb54fbd7</Sha>
<SourceBuild RepoName="command-line-api" ManagedOnly="true" />
</Dependency>
<!-- Intermediate is necessary for source build. -->
Expand All @@ -475,34 +475,34 @@
<Uri>https://github.com/dotnet/deployment-tools</Uri>
<Sha>5b816ec322774fff1f84d27e8d401cf145e0a2ca</Sha>
</Dependency>
<Dependency Name="Microsoft.Build.Tasks.Git" Version="10.0.0-beta.25080.2">
<Dependency Name="Microsoft.Build.Tasks.Git" Version="10.0.0-beta.25081.2">
<Uri>https://github.com/dotnet/sourcelink</Uri>
<Sha>fab841741055c19fc07623f8947cecc9a0f63baa</Sha>
<Sha>3c34adccbef5b95e680bc6e6424e3ebbbf4cd294</Sha>
</Dependency>
<Dependency Name="Microsoft.SourceLink.Common" Version="10.0.0-beta.25080.2">
<Dependency Name="Microsoft.SourceLink.Common" Version="10.0.0-beta.25081.2">
<Uri>https://github.com/dotnet/sourcelink</Uri>
<Sha>fab841741055c19fc07623f8947cecc9a0f63baa</Sha>
<Sha>3c34adccbef5b95e680bc6e6424e3ebbbf4cd294</Sha>
</Dependency>
<Dependency Name="Microsoft.SourceLink.AzureRepos.Git" Version="10.0.0-beta.25080.2">
<Dependency Name="Microsoft.SourceLink.AzureRepos.Git" Version="10.0.0-beta.25081.2">
<Uri>https://github.com/dotnet/sourcelink</Uri>
<Sha>fab841741055c19fc07623f8947cecc9a0f63baa</Sha>
<Sha>3c34adccbef5b95e680bc6e6424e3ebbbf4cd294</Sha>
</Dependency>
<Dependency Name="Microsoft.SourceLink.GitHub" Version="10.0.0-beta.25080.2">
<Dependency Name="Microsoft.SourceLink.GitHub" Version="10.0.0-beta.25081.2">
<Uri>https://github.com/dotnet/sourcelink</Uri>
<Sha>fab841741055c19fc07623f8947cecc9a0f63baa</Sha>
<Sha>3c34adccbef5b95e680bc6e6424e3ebbbf4cd294</Sha>
</Dependency>
<Dependency Name="Microsoft.SourceLink.GitLab" Version="10.0.0-beta.25080.2">
<Dependency Name="Microsoft.SourceLink.GitLab" Version="10.0.0-beta.25081.2">
<Uri>https://github.com/dotnet/sourcelink</Uri>
<Sha>fab841741055c19fc07623f8947cecc9a0f63baa</Sha>
<Sha>3c34adccbef5b95e680bc6e6424e3ebbbf4cd294</Sha>
</Dependency>
<Dependency Name="Microsoft.SourceLink.Bitbucket.Git" Version="10.0.0-beta.25080.2">
<Dependency Name="Microsoft.SourceLink.Bitbucket.Git" Version="10.0.0-beta.25081.2">
<Uri>https://github.com/dotnet/sourcelink</Uri>
<Sha>fab841741055c19fc07623f8947cecc9a0f63baa</Sha>
<Sha>3c34adccbef5b95e680bc6e6424e3ebbbf4cd294</Sha>
</Dependency>
<!-- Intermediate is necessary for source build. -->
<Dependency Name="Microsoft.SourceBuild.Intermediate.sourcelink" Version="10.0.0-beta.25080.2">
<Dependency Name="Microsoft.SourceBuild.Intermediate.sourcelink" Version="10.0.0-beta.25081.2">
<Uri>https://github.com/dotnet/sourcelink</Uri>
<Sha>fab841741055c19fc07623f8947cecc9a0f63baa</Sha>
<Sha>3c34adccbef5b95e680bc6e6424e3ebbbf4cd294</Sha>
<SourceBuild RepoName="sourcelink" ManagedOnly="true" />
</Dependency>
<!-- Intermediate is necessary for source build. -->
Expand Down Expand Up @@ -604,34 +604,34 @@
</Dependency>
</ProductDependencies>
<ToolsetDependencies>
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="10.0.0-beta.25080.7">
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="10.0.0-beta.25103.6">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>bbea86c614fcf4380c58c80eacd279a0b8305a79</Sha>
<Sha>0b971a5e11be58af22ca83fbc111a1207bb62920</Sha>
</Dependency>
<Dependency Name="Microsoft.DotNet.Build.Tasks.Installers" Version="10.0.0-beta.25080.7">
<Dependency Name="Microsoft.DotNet.Build.Tasks.Installers" Version="10.0.0-beta.25103.6">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>bbea86c614fcf4380c58c80eacd279a0b8305a79</Sha>
<Sha>0b971a5e11be58af22ca83fbc111a1207bb62920</Sha>
</Dependency>
<Dependency Name="Microsoft.DotNet.Helix.Sdk" Version="10.0.0-beta.25080.7">
<Dependency Name="Microsoft.DotNet.Helix.Sdk" Version="10.0.0-beta.25103.6">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>bbea86c614fcf4380c58c80eacd279a0b8305a79</Sha>
<Sha>0b971a5e11be58af22ca83fbc111a1207bb62920</Sha>
</Dependency>
<Dependency Name="Microsoft.DotNet.SignTool" Version="10.0.0-beta.25080.7">
<Dependency Name="Microsoft.DotNet.SignTool" Version="10.0.0-beta.25103.6">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>bbea86c614fcf4380c58c80eacd279a0b8305a79</Sha>
<Sha>0b971a5e11be58af22ca83fbc111a1207bb62920</Sha>
</Dependency>
<Dependency Name="Microsoft.DotNet.XUnitExtensions" Version="10.0.0-beta.25080.7">
<Dependency Name="Microsoft.DotNet.XUnitExtensions" Version="10.0.0-beta.25103.6">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>bbea86c614fcf4380c58c80eacd279a0b8305a79</Sha>
<Sha>0b971a5e11be58af22ca83fbc111a1207bb62920</Sha>
</Dependency>
<Dependency Name="Microsoft.DotNet.XliffTasks" Version="10.0.0-beta.25080.7">
<Dependency Name="Microsoft.DotNet.XliffTasks" Version="10.0.0-beta.25103.6">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>bbea86c614fcf4380c58c80eacd279a0b8305a79</Sha>
<Sha>0b971a5e11be58af22ca83fbc111a1207bb62920</Sha>
</Dependency>
<!-- Intermediate is necessary for source build. -->
<Dependency Name="Microsoft.SourceBuild.Intermediate.arcade" Version="10.0.0-beta.25080.7">
<Dependency Name="Microsoft.SourceBuild.Intermediate.arcade" Version="10.0.0-beta.25103.6">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>bbea86c614fcf4380c58c80eacd279a0b8305a79</Sha>
<Sha>0b971a5e11be58af22ca83fbc111a1207bb62920</Sha>
<SourceBuild RepoName="arcade" ManagedOnly="true" />
</Dependency>
<Dependency Name="System.Reflection.MetadataLoadContext" Version="10.0.0-preview.2.25102.2">
Expand Down
22 changes: 11 additions & 11 deletions eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
<SystemDataSqlClientPackageVersion>4.8.6</SystemDataSqlClientPackageVersion>
<StyleCopAnalyzersPackageVersion>1.2.0-beta.435</StyleCopAnalyzersPackageVersion>
<WebDeploymentPackageVersion>4.0.5</WebDeploymentPackageVersion>
<SystemCommandLineVersion>2.0.0-beta4.25071.2</SystemCommandLineVersion>
<SystemCommandLineVersion>2.0.0-beta4.25072.1</SystemCommandLineVersion>
<MicrosoftDeploymentDotNetReleasesVersion>2.0.0-preview.1.25077.1</MicrosoftDeploymentDotNetReleasesVersion>
<MicrosoftDiaSymReaderVersion>2.2.0-beta.25076.1</MicrosoftDiaSymReaderVersion>
<MicrosoftCodeAnalysisAnalyzerTestingVersion>1.1.2-beta1.22216.1</MicrosoftCodeAnalysisAnalyzerTestingVersion>
Expand Down Expand Up @@ -270,19 +270,19 @@
</PropertyGroup>
<PropertyGroup>
<!-- Dependencies from https://github.com/dotnet/arcade -->
<MicrosoftDotNetBuildTasksInstallersPackageVersion>10.0.0-beta.25080.7</MicrosoftDotNetBuildTasksInstallersPackageVersion>
<MicrosoftDotNetSignToolVersion>10.0.0-beta.25080.7</MicrosoftDotNetSignToolVersion>
<MicrosoftDotNetXliffTasksVersion>10.0.0-beta.25080.7</MicrosoftDotNetXliffTasksVersion>
<MicrosoftDotNetXUnitExtensionsVersion>10.0.0-beta.25080.7</MicrosoftDotNetXUnitExtensionsVersion>
<MicrosoftDotNetBuildTasksInstallersPackageVersion>10.0.0-beta.25103.6</MicrosoftDotNetBuildTasksInstallersPackageVersion>
<MicrosoftDotNetSignToolVersion>10.0.0-beta.25103.6</MicrosoftDotNetSignToolVersion>
<MicrosoftDotNetXliffTasksVersion>10.0.0-beta.25103.6</MicrosoftDotNetXliffTasksVersion>
<MicrosoftDotNetXUnitExtensionsVersion>10.0.0-beta.25103.6</MicrosoftDotNetXUnitExtensionsVersion>
</PropertyGroup>
<PropertyGroup>
<!-- Dependencies from https://github.com/dotnet/sourcelink -->
<MicrosoftBuildTasksGitVersion>10.0.0-beta.25080.2</MicrosoftBuildTasksGitVersion>
<MicrosoftSourceLinkCommonVersion>10.0.0-beta.25080.2</MicrosoftSourceLinkCommonVersion>
<MicrosoftSourceLinkAzureReposGitVersion>10.0.0-beta.25080.2</MicrosoftSourceLinkAzureReposGitVersion>
<MicrosoftSourceLinkGitHubVersion>10.0.0-beta.25080.2</MicrosoftSourceLinkGitHubVersion>
<MicrosoftSourceLinkGitLabVersion>10.0.0-beta.25080.2</MicrosoftSourceLinkGitLabVersion>
<MicrosoftSourceLinkBitbucketGitVersion>10.0.0-beta.25080.2</MicrosoftSourceLinkBitbucketGitVersion>
<MicrosoftBuildTasksGitVersion>10.0.0-beta.25081.2</MicrosoftBuildTasksGitVersion>
<MicrosoftSourceLinkCommonVersion>10.0.0-beta.25081.2</MicrosoftSourceLinkCommonVersion>
<MicrosoftSourceLinkAzureReposGitVersion>10.0.0-beta.25081.2</MicrosoftSourceLinkAzureReposGitVersion>
<MicrosoftSourceLinkGitHubVersion>10.0.0-beta.25081.2</MicrosoftSourceLinkGitHubVersion>
<MicrosoftSourceLinkGitLabVersion>10.0.0-beta.25081.2</MicrosoftSourceLinkGitLabVersion>
<MicrosoftSourceLinkBitbucketGitVersion>10.0.0-beta.25081.2</MicrosoftSourceLinkBitbucketGitVersion>
</PropertyGroup>
<!-- Get .NET Framework reference assemblies from NuGet packages -->
<PropertyGroup>
Expand Down
4 changes: 2 additions & 2 deletions global.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
"cmake": "latest"
},
"msbuild-sdks": {
"Microsoft.DotNet.Arcade.Sdk": "10.0.0-beta.25080.7",
"Microsoft.DotNet.Helix.Sdk": "10.0.0-beta.25080.7",
"Microsoft.DotNet.Arcade.Sdk": "10.0.0-beta.25103.6",
"Microsoft.DotNet.Helix.Sdk": "10.0.0-beta.25103.6",
"Microsoft.Build.NoTargets": "3.7.0",
"Microsoft.DotNet.CMake.Sdk": "9.0.0-beta.24217.1"
}
Expand Down
10 changes: 5 additions & 5 deletions src/BlazorWasmSdk/Tool/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,20 @@ internal static class Program
{
public static int Main(string[] args)
{
CliRootCommand rootCommand = new();
CliCommand brotli = new("brotli");
RootCommand rootCommand = new();
Command brotli = new("brotli");

CliOption<CompressionLevel> compressionLevelOption = new("-c")
Option<CompressionLevel> compressionLevelOption = new("-c")
{
DefaultValueFactory = _ => CompressionLevel.SmallestSize,
Description = "System.IO.Compression.CompressionLevel for the Brotli compression algorithm.",
};
CliOption<List<string>> sourcesOption = new("-s")
Option<List<string>> sourcesOption = new("-s")
{
Description = "A list of files to compress.",
AllowMultipleArgumentsPerToken = false
};
CliOption<List<string>> outputsOption = new("-o")
Option<List<string>> outputsOption = new("-o")
{
Description = "The filenames to output the compressed file to.",
AllowMultipleArgumentsPerToken = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ internal static class FormatAnalyzersCommand
{
private static readonly FormatAnalyzersHandler s_analyzerHandler = new();

internal static CliCommand GetCommand()
internal static Command GetCommand()
{
var command = new CliCommand("analyzers", Resources.Run_3rd_party_analyzers__and_apply_fixes)
var command = new Command("analyzers", Resources.Run_3rd_party_analyzers__and_apply_fixes)
{
DiagnosticsOption,
ExcludeDiagnosticsOption,
Expand All @@ -25,7 +25,7 @@ internal static CliCommand GetCommand()
return command;
}

private class FormatAnalyzersHandler : AsynchronousCliAction
private class FormatAnalyzersHandler : AsynchronousCommandLineAction
{
public override async Task<int> InvokeAsync(ParseResult parseResult, CancellationToken cancellationToken)
{
Expand Down
30 changes: 15 additions & 15 deletions src/BuiltInTools/dotnet-format/Commands/FormatCommandCommon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,67 +19,67 @@ internal static class FormatCommandCommon
private static string[] VerbosityLevels => new[] { "q", "quiet", "m", "minimal", "n", "normal", "d", "detailed", "diag", "diagnostic" };
private static string[] SeverityLevels => new[] { "info", "warn", "error" };

public static readonly CliArgument<string> SlnOrProjectArgument = new CliArgument<string>(Resources.SolutionOrProjectArgumentName)
public static readonly Argument<string> SlnOrProjectArgument = new Argument<string>(Resources.SolutionOrProjectArgumentName)
{
Description = Resources.SolutionOrProjectArgumentDescription,
Arity = ArgumentArity.ZeroOrOne
}.DefaultToCurrentDirectory();

internal static readonly CliOption<bool> FolderOption = new("--folder")
internal static readonly Option<bool> FolderOption = new("--folder")
{
Description = Resources.Whether_to_treat_the_workspace_argument_as_a_simple_folder_of_files,
};
internal static readonly CliOption<bool> NoRestoreOption = new("--no-restore")
internal static readonly Option<bool> NoRestoreOption = new("--no-restore")
{
Description = Resources.Doesnt_execute_an_implicit_restore_before_formatting,
};
internal static readonly CliOption<bool> VerifyNoChanges = new("--verify-no-changes")
internal static readonly Option<bool> VerifyNoChanges = new("--verify-no-changes")
{
Description = Resources.Verify_no_formatting_changes_would_be_performed_Terminates_with_a_non_zero_exit_code_if_any_files_would_have_been_formatted,
};
internal static readonly CliOption<string[]> DiagnosticsOption = new("--diagnostics")
internal static readonly Option<string[]> DiagnosticsOption = new("--diagnostics")
{
AllowMultipleArgumentsPerToken = true,
DefaultValueFactory = _ => Array.Empty<string>(),
Description = Resources.A_space_separated_list_of_diagnostic_ids_to_use_as_a_filter_when_fixing_code_style_or_3rd_party_issues,
};
internal static readonly CliOption<string[]> ExcludeDiagnosticsOption = new("--exclude-diagnostics")
internal static readonly Option<string[]> ExcludeDiagnosticsOption = new("--exclude-diagnostics")
{
AllowMultipleArgumentsPerToken = true,
DefaultValueFactory = _ => Array.Empty<string>(),
Description = Resources.A_space_separated_list_of_diagnostic_ids_to_ignore_when_fixing_code_style_or_3rd_party_issues,
};
internal static readonly CliOption<string> SeverityOption = new CliOption<string>("--severity")
internal static readonly Option<string> SeverityOption = new Option<string>("--severity")
{
Description = Resources.The_severity_of_diagnostics_to_fix_Allowed_values_are_info_warn_and_error,
};
internal static readonly CliOption<string[]> IncludeOption = new("--include")
internal static readonly Option<string[]> IncludeOption = new("--include")
{
AllowMultipleArgumentsPerToken = true,
DefaultValueFactory = _ => Array.Empty<string>(),
Description = Resources.A_list_of_relative_file_or_folder_paths_to_include_in_formatting_All_files_are_formatted_if_empty,
};
internal static readonly CliOption<string[]> ExcludeOption = new("--exclude")
internal static readonly Option<string[]> ExcludeOption = new("--exclude")
{
AllowMultipleArgumentsPerToken = true,
DefaultValueFactory = _ => Array.Empty<string>(),
Description = Resources.A_list_of_relative_file_or_folder_paths_to_exclude_from_formatting,
};
internal static readonly CliOption<bool> IncludeGeneratedOption = new("--include-generated")
internal static readonly Option<bool> IncludeGeneratedOption = new("--include-generated")
{
Description = Resources.Format_files_generated_by_the_SDK,
};
internal static readonly CliOption<string> VerbosityOption = new CliOption<string>("--verbosity", "-v")
internal static readonly Option<string> VerbosityOption = new Option<string>("--verbosity", "-v")
{
Description = Resources.Set_the_verbosity_level_Allowed_values_are_quiet_minimal_normal_detailed_and_diagnostic,
};
internal static readonly CliOption<string> BinarylogOption = new CliOption<string>("--binarylog")
internal static readonly Option<string> BinarylogOption = new Option<string>("--binarylog")
{
HelpName = "binary-log-path",
Arity = ArgumentArity.ZeroOrOne,
Description = Resources.Log_all_project_or_solution_load_information_to_a_binary_log_file,
};
internal static readonly CliOption<string> ReportOption = new CliOption<string>("--report")
internal static readonly Option<string> ReportOption = new Option<string>("--report")
{
HelpName = "report-path",
Arity = ArgumentArity.ZeroOrOne,
Expand Down Expand Up @@ -118,7 +118,7 @@ internal static async Task<int> FormatAsync(FormatOptions formatOptions, ILogger
return formatResult.GetExitCode(formatOptions.ChangesAreErrors);
}

public static void AddCommonOptions(this CliCommand command)
public static void AddCommonOptions(this Command command)
{
command.Arguments.Add(SlnOrProjectArgument);
command.Options.Add(NoRestoreOption);
Expand All @@ -131,7 +131,7 @@ public static void AddCommonOptions(this CliCommand command)
command.Options.Add(ReportOption);
}

public static CliArgument<string> DefaultToCurrentDirectory(this CliArgument<string> arg)
public static Argument<string> DefaultToCurrentDirectory(this Argument<string> arg)
{
arg.DefaultValueFactory = _ => EnsureTrailingSlash(Directory.GetCurrentDirectory());
return arg;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ internal static class FormatStyleCommand
{
private static readonly FormatStyleHandler s_styleHandler = new();

internal static CliCommand GetCommand()
internal static Command GetCommand()
{
var command = new CliCommand("style", Resources.Run_code_style_analyzers_and_apply_fixes)
var command = new Command("style", Resources.Run_code_style_analyzers_and_apply_fixes)
{
DiagnosticsOption,
ExcludeDiagnosticsOption,
Expand All @@ -25,7 +25,7 @@ internal static CliCommand GetCommand()
return command;
}

private class FormatStyleHandler : AsynchronousCliAction
private class FormatStyleHandler : AsynchronousCommandLineAction
{
public override async Task<int> InvokeAsync(ParseResult parseResult, CancellationToken cancellationToken)
{
Expand Down
Loading
Loading