Skip to content
Merged
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
8 changes: 4 additions & 4 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
Expand Up @@ -246,13 +246,13 @@
<Sha>83c80bfbd2d283405d94af5e4bb496bf7d185b01</Sha>
<SourceBuild RepoName="roslyn-analyzers" ManagedOnly="true" />
</Dependency>
<Dependency Name="System.CommandLine" Version="2.0.0-beta4.22526.1">
<Dependency Name="System.CommandLine" Version="2.0.0-beta4.22564.1">
<Uri>https://github.com/dotnet/command-line-api</Uri>
<Sha>605dd1d76ddfea34aa42b4337dfb3f7b467acb0d</Sha>
<Sha>8374d5fca634a93458c84414b1604c12f765d1ab</Sha>
</Dependency>
<Dependency Name="Microsoft.SourceBuild.Intermediate.command-line-api" Version="0.1.352601">
<Dependency Name="Microsoft.SourceBuild.Intermediate.command-line-api" Version="0.1.356401">
<Uri>https://github.com/dotnet/command-line-api</Uri>
<Sha>605dd1d76ddfea34aa42b4337dfb3f7b467acb0d</Sha>
<Sha>8374d5fca634a93458c84414b1604c12f765d1ab</Sha>
<SourceBuild RepoName="command-line-api" ManagedOnly="true" />
</Dependency>
<Dependency Name="Microsoft.SourceBuild.Intermediate.source-build-externals" Version="8.0.0-alpha.1.22552.1">
Expand Down
2 changes: 1 addition & 1 deletion eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
<SystemTextJsonVersion>6.0.0</SystemTextJsonVersion>
<SystemReflectionMetadataLoadContextVersion>8.0.0-alpha.1.22559.2</SystemReflectionMetadataLoadContextVersion>
<SystemManagementPackageVersion>4.6.0</SystemManagementPackageVersion>
<SystemCommandLineVersion>2.0.0-beta4.22526.1</SystemCommandLineVersion>
<SystemCommandLineVersion>2.0.0-beta4.22564.1</SystemCommandLineVersion>
<MicrosoftDeploymentDotNetReleasesVersion>1.0.0-preview5.1.22263.1</MicrosoftDeploymentDotNetReleasesVersion>
<MicrosoftVisualStudioSetupConfigurationInteropVersion>3.0.4496</MicrosoftVisualStudioSetupConfigurationInteropVersion>
</PropertyGroup>
Expand Down
70 changes: 35 additions & 35 deletions src/ApiCompat/Microsoft.DotNet.ApiCompat.Tool/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -125,27 +125,27 @@ static int Main(string[] args)
rootCommand.SetHandler((InvocationContext context) =>
{
// If a roslyn assemblies path isn't provided, use the compiled against version from a subfolder.
string roslynAssembliesPath = context.ParseResult.GetValueForOption(roslynAssembliesPathOption) ??
string roslynAssembliesPath = context.ParseResult.GetValue(roslynAssembliesPathOption) ??
Path.Combine(AppContext.BaseDirectory, "codeanalysis");
RoslynResolver roslynResolver = RoslynResolver.Register(roslynAssembliesPath);

MessageImportance verbosity = context.ParseResult.GetValueForOption(verbosityOption);
bool generateSuppressionFile = context.ParseResult.GetValueForOption(generateSuppressionFileOption);
string[]? suppressionFiles = context.ParseResult.GetValueForOption(suppressionFilesOption);
string? suppressionOutputFile = context.ParseResult.GetValueForOption(suppressionOutputFileOption);
string? noWarn = context.ParseResult.GetValueForOption(noWarnOption);
bool enableRuleAttributesMustMatch = context.ParseResult.GetValueForOption(enableRuleAttributesMustMatchOption);
string[]? excludeAttributesFiles = context.ParseResult.GetValueForOption(excludeAttributesFilesOption);
bool enableRuleCannotChangeParameterName = context.ParseResult.GetValueForOption(enableRuleCannotChangeParameterNameOption);
MessageImportance verbosity = context.ParseResult.GetValue(verbosityOption);
bool generateSuppressionFile = context.ParseResult.GetValue(generateSuppressionFileOption);
string[]? suppressionFiles = context.ParseResult.GetValue(suppressionFilesOption);
string? suppressionOutputFile = context.ParseResult.GetValue(suppressionOutputFileOption);
string? noWarn = context.ParseResult.GetValue(noWarnOption);
bool enableRuleAttributesMustMatch = context.ParseResult.GetValue(enableRuleAttributesMustMatchOption);
string[]? excludeAttributesFiles = context.ParseResult.GetValue(excludeAttributesFilesOption);
bool enableRuleCannotChangeParameterName = context.ParseResult.GetValue(enableRuleCannotChangeParameterNameOption);

string[] leftAssemblies = context.ParseResult.GetValueForOption(leftAssembliesOption)!;
string[] rightAssemblies = context.ParseResult.GetValueForOption(rightAssembliesOption)!;
bool strictMode = context.ParseResult.GetValueForOption(strictModeOption);
string[][]? leftAssembliesReferences = context.ParseResult.GetValueForOption(leftAssembliesReferencesOption);
string[][]? rightAssembliesReferences = context.ParseResult.GetValueForOption(rightAssembliesReferencesOption);
bool createWorkItemPerAssembly = context.ParseResult.GetValueForOption(createWorkItemPerAssemblyOption);
(string, string)[]? leftAssembliesTransformationPattern = context.ParseResult.GetValueForOption(leftAssembliesTransformationPatternOption);
(string, string)[]? rightAssembliesTransformationPattern = context.ParseResult.GetValueForOption(rightAssembliesTransformationPatternOption);
string[] leftAssemblies = context.ParseResult.GetValue(leftAssembliesOption)!;
string[] rightAssemblies = context.ParseResult.GetValue(rightAssembliesOption)!;
bool strictMode = context.ParseResult.GetValue(strictModeOption);
string[][]? leftAssembliesReferences = context.ParseResult.GetValue(leftAssembliesReferencesOption);
string[][]? rightAssembliesReferences = context.ParseResult.GetValue(rightAssembliesReferencesOption);
bool createWorkItemPerAssembly = context.ParseResult.GetValue(createWorkItemPerAssemblyOption);
(string, string)[]? leftAssembliesTransformationPattern = context.ParseResult.GetValue(leftAssembliesTransformationPatternOption);
(string, string)[]? rightAssembliesTransformationPattern = context.ParseResult.GetValue(rightAssembliesTransformationPatternOption);

Func<ISuppressionEngine, ConsoleCompatibilityLogger> logFactory = (suppressionEngine) => new(suppressionEngine, verbosity);
ValidateAssemblies.Run(logFactory,
Expand Down Expand Up @@ -223,28 +223,28 @@ static int Main(string[] args)
packageCommand.SetHandler((InvocationContext context) =>
{
// If a roslyn assemblies path isn't provided, use the compiled against version from a subfolder.
string roslynAssembliesPath = context.ParseResult.GetValueForOption(roslynAssembliesPathOption) ??
string roslynAssembliesPath = context.ParseResult.GetValue(roslynAssembliesPathOption) ??
Path.Combine(AppContext.BaseDirectory, "codeanalysis");
RoslynResolver roslynResolver = RoslynResolver.Register(roslynAssembliesPath);

MessageImportance verbosity = context.ParseResult.GetValueForOption(verbosityOption);
bool generateSuppressionFile = context.ParseResult.GetValueForOption(generateSuppressionFileOption);
string[]? suppressionFiles = context.ParseResult.GetValueForOption(suppressionFilesOption);
string? suppressionOutputFile = context.ParseResult.GetValueForOption(suppressionOutputFileOption);
string? noWarn = context.ParseResult.GetValueForOption(noWarnOption);
bool enableRuleAttributesMustMatch = context.ParseResult.GetValueForOption(enableRuleAttributesMustMatchOption);
string[]? excludeAttributesFiles = context.ParseResult.GetValueForOption(excludeAttributesFilesOption);
bool enableRuleCannotChangeParameterName = context.ParseResult.GetValueForOption(enableRuleCannotChangeParameterNameOption);
MessageImportance verbosity = context.ParseResult.GetValue(verbosityOption);
bool generateSuppressionFile = context.ParseResult.GetValue(generateSuppressionFileOption);
string[]? suppressionFiles = context.ParseResult.GetValue(suppressionFilesOption);
string? suppressionOutputFile = context.ParseResult.GetValue(suppressionOutputFileOption);
string? noWarn = context.ParseResult.GetValue(noWarnOption);
bool enableRuleAttributesMustMatch = context.ParseResult.GetValue(enableRuleAttributesMustMatchOption);
string[]? excludeAttributesFiles = context.ParseResult.GetValue(excludeAttributesFilesOption);
bool enableRuleCannotChangeParameterName = context.ParseResult.GetValue(enableRuleCannotChangeParameterNameOption);

string package = context.ParseResult.GetValueForArgument(packageArgument);
bool runApiCompat = context.ParseResult.GetValueForOption(runApiCompatOption);
bool enableStrictModeForCompatibleTfms = context.ParseResult.GetValueForOption(enableStrictModeForCompatibleTfmsOption);
bool enableStrictModeForCompatibleFrameworksInPackage = context.ParseResult.GetValueForOption(enableStrictModeForCompatibleFrameworksInPackageOption);
bool enableStrictModeForBaselineValidation = context.ParseResult.GetValueForOption(enableStrictModeForBaselineValidationOption);
string? baselinePackage = context.ParseResult.GetValueForOption(baselinePackageOption);
string? runtimeGraph = context.ParseResult.GetValueForOption(runtimeGraphOption);
Dictionary<string, string[]>? packageAssemblyReferences = context.ParseResult.GetValueForOption(packageAssemblyReferencesOption);
Dictionary<string, string[]>? baselinePackageAssemblyReferences = context.ParseResult.GetValueForOption(baselinePackageAssemblyReferencesOption);
string package = context.ParseResult.GetValue(packageArgument);
bool runApiCompat = context.ParseResult.GetValue(runApiCompatOption);
bool enableStrictModeForCompatibleTfms = context.ParseResult.GetValue(enableStrictModeForCompatibleTfmsOption);
bool enableStrictModeForCompatibleFrameworksInPackage = context.ParseResult.GetValue(enableStrictModeForCompatibleFrameworksInPackageOption);
bool enableStrictModeForBaselineValidation = context.ParseResult.GetValue(enableStrictModeForBaselineValidationOption);
string? baselinePackage = context.ParseResult.GetValue(baselinePackageOption);
string? runtimeGraph = context.ParseResult.GetValue(runtimeGraphOption);
Dictionary<string, string[]>? packageAssemblyReferences = context.ParseResult.GetValue(packageAssemblyReferencesOption);
Dictionary<string, string[]>? baselinePackageAssemblyReferences = context.ParseResult.GetValue(baselinePackageAssemblyReferencesOption);

Func<ISuppressionEngine, ConsoleCompatibilityLogger> logFactory = (suppressionEngine) => new(suppressionEngine, verbosity);
ValidatePackage.Run(logFactory,
Expand Down
8 changes: 4 additions & 4 deletions src/BlazorWasmSdk/Tool/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public static int Main(string[] args)

var compressionLevelOption = new Option<CompressionLevel>(
"-c",
getDefaultValue: () => CompressionLevel.SmallestSize,
defaultValueFactory: () => CompressionLevel.SmallestSize,
description: "System.IO.Compression.CompressionLevel for the Brotli compression algorithm.");
var sourcesOption = new Option<List<string>>(
"-s",
Expand All @@ -46,9 +46,9 @@ public static int Main(string[] args)
brotli.SetHandler((InvocationContext context) =>
{
var parseResults = context.ParseResult;
var c = parseResults.GetValueForOption(compressionLevelOption);
var s = parseResults.GetValueForOption(sourcesOption);
var o = parseResults.GetValueForOption(outputsOption);
var c = parseResults.GetValue(compressionLevelOption);
var s = parseResults.GetValue(sourcesOption);
var o = parseResults.GetValue(outputsOption);

Parallel.For(0, s.Count, i =>
{
Expand Down
18 changes: 9 additions & 9 deletions src/BuiltInTools/dotnet-watch/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -474,11 +474,11 @@ internal CommandLineOptionsBinder(
protected override CommandLineOptions GetBoundValue(BindingContext bindingContext)
{
var parseResults = bindingContext.ParseResult;
var projectValue = parseResults.GetValueForOption(_longProjectOption);
var projectValue = parseResults.GetValue(_longProjectOption);
if (string.IsNullOrEmpty(projectValue))
{
#pragma warning disable CS0618 // Type or member is obsolete
var projectShortValue = parseResults.GetValueForOption(_shortProjectOption);
var projectShortValue = parseResults.GetValue(_shortProjectOption);
#pragma warning restore CS0618 // Type or member is obsolete
if (!string.IsNullOrEmpty(projectShortValue))
{
Expand All @@ -489,14 +489,14 @@ protected override CommandLineOptions GetBoundValue(BindingContext bindingContex

var options = new CommandLineOptions
{
Quiet = parseResults.GetValueForOption(_quietOption),
List = parseResults.GetValueForOption(_listOption),
NoHotReload = parseResults.GetValueForOption(_noHotReloadOption),
NonInteractive = parseResults.GetValueForOption(_nonInteractiveOption),
Verbose = parseResults.GetValueForOption(_verboseOption),
Quiet = parseResults.GetValue(_quietOption),
List = parseResults.GetValue(_listOption),
NoHotReload = parseResults.GetValue(_noHotReloadOption),
NonInteractive = parseResults.GetValue(_nonInteractiveOption),
Verbose = parseResults.GetValue(_verboseOption),
Project = projectValue,
LaunchProfile = parseResults.GetValueForOption(_launchProfileOption),
RemainingArguments = parseResults.GetValueForArgument(_argumentsToForward),
LaunchProfile = parseResults.GetValue(_launchProfileOption),
RemainingArguments = parseResults.GetValue(_argumentsToForward),
};
return options;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ protected override Option GetBaseOption(IReadOnlySet<string> aliases)
/// Custom parse method for template option.
/// It is mainly required to process default if no option value cases.
/// </summary>
private static ParseArgument<string> GetParseChoiceArgument(ChoiceTemplateParameter parameter)
private static Func<ArgumentResult, string> GetParseChoiceArgument(ChoiceTemplateParameter parameter)
{
return (argumentResult) =>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ private static ParameterType ParseType(string dataType)
};
}

private static ParseArgument<T> GetParseArgument<T>(CliTemplateParameter parameter, Func<string?, (bool, T)> convert)
private static Func<ArgumentResult, T> GetParseArgument<T>(CliTemplateParameter parameter, Func<string?, (bool, T)> convert)
{
return (argumentResult) =>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ internal static bool HasErrorFor(this ParseResult parseResult, Option option)
}

/// <summary>
/// Case insensitive version for <see cref="System.CommandLine.OptionExtensions.FromAmong{TOption}(TOption, string[])"/>.
/// Case insensitive version for <see cref="System.CommandLine.Option{TOption}.AcceptOnlyFromAmong(string[])"/>.
/// </summary>
internal static void FromAmongCaseInsensitive(this Option<string> option, string[]? allowedValues = null, string? allowedHiddenValue = null)
{
Expand Down
14 changes: 7 additions & 7 deletions src/Cli/Microsoft.TemplateEngine.Cli/Commands/GlobalArgs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ internal class GlobalArgs : ICommandArgs
{
public GlobalArgs(BaseCommand command, ParseResult parseResult)
{
DebugCustomSettingsLocation = parseResult.GetValueForOption(NewCommand.DebugCustomSettingsLocationOption);
DebugVirtualizeSettings = parseResult.GetValueForOption(NewCommand.DebugVirtualizeSettingsOption);
DebugAttach = parseResult.GetValueForOption(NewCommand.DebugAttachOption);
DebugReinit = parseResult.GetValueForOption(NewCommand.DebugReinitOption);
DebugRebuildCache = parseResult.GetValueForOption(NewCommand.DebugRebuildCacheOption);
DebugShowConfig = parseResult.GetValueForOption(NewCommand.DebugShowConfigOption);
DebugCustomSettingsLocation = parseResult.GetValue(NewCommand.DebugCustomSettingsLocationOption);
DebugVirtualizeSettings = parseResult.GetValue(NewCommand.DebugVirtualizeSettingsOption);
DebugAttach = parseResult.GetValue(NewCommand.DebugAttachOption);
DebugReinit = parseResult.GetValue(NewCommand.DebugReinitOption);
DebugRebuildCache = parseResult.GetValue(NewCommand.DebugRebuildCacheOption);
DebugShowConfig = parseResult.GetValue(NewCommand.DebugShowConfigOption);
ParseResult = parseResult;
Command = command;
RootCommand = GetNewCommandFromParseResult(parseResult);
Expand Down Expand Up @@ -53,7 +53,7 @@ protected GlobalArgs(GlobalArgs args) : this(args.Command, args.ParseResult) { }

protected static (bool, IReadOnlyList<string>?) ParseTabularOutputSettings(ITabularOutputCommand command, ParseResult parseResult)
{
return (parseResult.GetValueForOption(command.ColumnsAllOption), parseResult.GetValueForOption(command.ColumnsOption));
return (parseResult.GetValue(command.ColumnsAllOption), parseResult.GetValue(command.ColumnsOption));
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ public interface ICustomHelp
/// <summary>
/// Returns custom help layout for the command.
/// </summary>
IEnumerable<HelpSectionDelegate> CustomHelpLayout();
IEnumerable<Action<HelpContext>> CustomHelpLayout();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace Microsoft.TemplateEngine.Cli.Commands
{
internal partial class NewCommand
{
public IEnumerable<HelpSectionDelegate> CustomHelpLayout()
public IEnumerable<Action<HelpContext>> CustomHelpLayout()
{
yield return (context) =>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public static class SharedOptions
Arity = new ArgumentArity(1, 1)
};

public static Option<FileInfo> ProjectPathOption { get; } = new Option<FileInfo>("--project", SymbolStrings.Option_ProjectPath).ExistingOnly();
public static Option<FileInfo> ProjectPathOption { get; } = new Option<FileInfo>("--project", SymbolStrings.Option_ProjectPath).AcceptExistingOnly();

internal static Option<bool> ForceOption { get; } = SharedOptionsFactory.CreateForceOption();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ internal static Option<string[]> CreateColumnsOption()
Description = SymbolStrings.Option_Columns,
AllowMultipleArgumentsPerToken = true,
};
option.FromAmong(
option.AcceptOnlyFromAmong(
TabularOutputSettings.ColumnNames.Author,
TabularOutputSettings.ColumnNames.Language,
TabularOutputSettings.ColumnNames.Type,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public static void WriteHelp(HelpContext context, InstantiateCommandArgs instant
ShowHintForOtherTemplates(templateGroup, preferredTemplate.Template, instantiateCommandArgs, context.Output);
}

public IEnumerable<HelpSectionDelegate> CustomHelpLayout()
public IEnumerable<Action<HelpContext>> CustomHelpLayout()
{
yield return (context) =>
{
Expand Down
Loading