diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml
index baa10875489b..fcf40aea1b51 100644
--- a/eng/Version.Details.xml
+++ b/eng/Version.Details.xml
@@ -246,13 +246,13 @@
83c80bfbd2d283405d94af5e4bb496bf7d185b01
-
+
https://github.com/dotnet/command-line-api
- 605dd1d76ddfea34aa42b4337dfb3f7b467acb0d
+ 8374d5fca634a93458c84414b1604c12f765d1ab
-
+
https://github.com/dotnet/command-line-api
- 605dd1d76ddfea34aa42b4337dfb3f7b467acb0d
+ 8374d5fca634a93458c84414b1604c12f765d1ab
diff --git a/eng/Versions.props b/eng/Versions.props
index b04a0d9005ad..caea2f2f33f0 100644
--- a/eng/Versions.props
+++ b/eng/Versions.props
@@ -42,7 +42,7 @@
6.0.0
8.0.0-alpha.1.22559.2
4.6.0
- 2.0.0-beta4.22526.1
+ 2.0.0-beta4.22564.1
1.0.0-preview5.1.22263.1
3.0.4496
diff --git a/src/ApiCompat/Microsoft.DotNet.ApiCompat.Tool/Program.cs b/src/ApiCompat/Microsoft.DotNet.ApiCompat.Tool/Program.cs
index 14edb0a661b2..25544c72da48 100644
--- a/src/ApiCompat/Microsoft.DotNet.ApiCompat.Tool/Program.cs
+++ b/src/ApiCompat/Microsoft.DotNet.ApiCompat.Tool/Program.cs
@@ -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 logFactory = (suppressionEngine) => new(suppressionEngine, verbosity);
ValidateAssemblies.Run(logFactory,
@@ -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? packageAssemblyReferences = context.ParseResult.GetValueForOption(packageAssemblyReferencesOption);
- Dictionary? 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? packageAssemblyReferences = context.ParseResult.GetValue(packageAssemblyReferencesOption);
+ Dictionary? baselinePackageAssemblyReferences = context.ParseResult.GetValue(baselinePackageAssemblyReferencesOption);
Func logFactory = (suppressionEngine) => new(suppressionEngine, verbosity);
ValidatePackage.Run(logFactory,
diff --git a/src/BlazorWasmSdk/Tool/Program.cs b/src/BlazorWasmSdk/Tool/Program.cs
index 55d97d2ef4cd..4a1aa68e7637 100644
--- a/src/BlazorWasmSdk/Tool/Program.cs
+++ b/src/BlazorWasmSdk/Tool/Program.cs
@@ -22,7 +22,7 @@ public static int Main(string[] args)
var compressionLevelOption = new Option(
"-c",
- getDefaultValue: () => CompressionLevel.SmallestSize,
+ defaultValueFactory: () => CompressionLevel.SmallestSize,
description: "System.IO.Compression.CompressionLevel for the Brotli compression algorithm.");
var sourcesOption = new Option>(
"-s",
@@ -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 =>
{
diff --git a/src/BuiltInTools/dotnet-watch/Program.cs b/src/BuiltInTools/dotnet-watch/Program.cs
index 6a552240fa31..21219eb2388e 100644
--- a/src/BuiltInTools/dotnet-watch/Program.cs
+++ b/src/BuiltInTools/dotnet-watch/Program.cs
@@ -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))
{
@@ -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;
}
diff --git a/src/Cli/Microsoft.TemplateEngine.Cli/ChoiceTemplateParameter.cs b/src/Cli/Microsoft.TemplateEngine.Cli/ChoiceTemplateParameter.cs
index d7802feea73f..4c5d6af6d7ea 100644
--- a/src/Cli/Microsoft.TemplateEngine.Cli/ChoiceTemplateParameter.cs
+++ b/src/Cli/Microsoft.TemplateEngine.Cli/ChoiceTemplateParameter.cs
@@ -89,7 +89,7 @@ protected override Option GetBaseOption(IReadOnlySet aliases)
/// Custom parse method for template option.
/// It is mainly required to process default if no option value cases.
///
- private static ParseArgument GetParseChoiceArgument(ChoiceTemplateParameter parameter)
+ private static Func GetParseChoiceArgument(ChoiceTemplateParameter parameter)
{
return (argumentResult) =>
{
diff --git a/src/Cli/Microsoft.TemplateEngine.Cli/CliTemplateParameter.cs b/src/Cli/Microsoft.TemplateEngine.Cli/CliTemplateParameter.cs
index f8dec9bad930..65eb2b2c5757 100644
--- a/src/Cli/Microsoft.TemplateEngine.Cli/CliTemplateParameter.cs
+++ b/src/Cli/Microsoft.TemplateEngine.Cli/CliTemplateParameter.cs
@@ -236,7 +236,7 @@ private static ParameterType ParseType(string dataType)
};
}
- private static ParseArgument GetParseArgument(CliTemplateParameter parameter, Func convert)
+ private static Func GetParseArgument(CliTemplateParameter parameter, Func convert)
{
return (argumentResult) =>
{
diff --git a/src/Cli/Microsoft.TemplateEngine.Cli/Commands/Extensions.cs b/src/Cli/Microsoft.TemplateEngine.Cli/Commands/Extensions.cs
index e4781a352604..5042ca88194a 100644
--- a/src/Cli/Microsoft.TemplateEngine.Cli/Commands/Extensions.cs
+++ b/src/Cli/Microsoft.TemplateEngine.Cli/Commands/Extensions.cs
@@ -46,7 +46,7 @@ internal static bool HasErrorFor(this ParseResult parseResult, Option option)
}
///
- /// Case insensitive version for .
+ /// Case insensitive version for .
///
internal static void FromAmongCaseInsensitive(this Option option, string[]? allowedValues = null, string? allowedHiddenValue = null)
{
diff --git a/src/Cli/Microsoft.TemplateEngine.Cli/Commands/GlobalArgs.cs b/src/Cli/Microsoft.TemplateEngine.Cli/Commands/GlobalArgs.cs
index 940ee2756e97..361e8e82ee13 100644
--- a/src/Cli/Microsoft.TemplateEngine.Cli/Commands/GlobalArgs.cs
+++ b/src/Cli/Microsoft.TemplateEngine.Cli/Commands/GlobalArgs.cs
@@ -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);
@@ -53,7 +53,7 @@ protected GlobalArgs(GlobalArgs args) : this(args.Command, args.ParseResult) { }
protected static (bool, IReadOnlyList?) ParseTabularOutputSettings(ITabularOutputCommand command, ParseResult parseResult)
{
- return (parseResult.GetValueForOption(command.ColumnsAllOption), parseResult.GetValueForOption(command.ColumnsOption));
+ return (parseResult.GetValue(command.ColumnsAllOption), parseResult.GetValue(command.ColumnsOption));
}
///
diff --git a/src/Cli/Microsoft.TemplateEngine.Cli/Commands/ICustomHelp.cs b/src/Cli/Microsoft.TemplateEngine.Cli/Commands/ICustomHelp.cs
index 3011ed8a018f..25013d70c41a 100644
--- a/src/Cli/Microsoft.TemplateEngine.Cli/Commands/ICustomHelp.cs
+++ b/src/Cli/Microsoft.TemplateEngine.Cli/Commands/ICustomHelp.cs
@@ -16,6 +16,6 @@ public interface ICustomHelp
///
/// Returns custom help layout for the command.
///
- IEnumerable CustomHelpLayout();
+ IEnumerable> CustomHelpLayout();
}
}
diff --git a/src/Cli/Microsoft.TemplateEngine.Cli/Commands/NewCommand.Help.cs b/src/Cli/Microsoft.TemplateEngine.Cli/Commands/NewCommand.Help.cs
index 77620607e8e8..194c1443e546 100644
--- a/src/Cli/Microsoft.TemplateEngine.Cli/Commands/NewCommand.Help.cs
+++ b/src/Cli/Microsoft.TemplateEngine.Cli/Commands/NewCommand.Help.cs
@@ -9,7 +9,7 @@ namespace Microsoft.TemplateEngine.Cli.Commands
{
internal partial class NewCommand
{
- public IEnumerable CustomHelpLayout()
+ public IEnumerable> CustomHelpLayout()
{
yield return (context) =>
{
diff --git a/src/Cli/Microsoft.TemplateEngine.Cli/Commands/SharedOptions.cs b/src/Cli/Microsoft.TemplateEngine.Cli/Commands/SharedOptions.cs
index 4d302dcdc05c..c305955b6799 100644
--- a/src/Cli/Microsoft.TemplateEngine.Cli/Commands/SharedOptions.cs
+++ b/src/Cli/Microsoft.TemplateEngine.Cli/Commands/SharedOptions.cs
@@ -15,7 +15,7 @@ public static class SharedOptions
Arity = new ArgumentArity(1, 1)
};
- public static Option ProjectPathOption { get; } = new Option("--project", SymbolStrings.Option_ProjectPath).ExistingOnly();
+ public static Option ProjectPathOption { get; } = new Option("--project", SymbolStrings.Option_ProjectPath).AcceptExistingOnly();
internal static Option ForceOption { get; } = SharedOptionsFactory.CreateForceOption();
diff --git a/src/Cli/Microsoft.TemplateEngine.Cli/Commands/SharedOptionsFactory.cs b/src/Cli/Microsoft.TemplateEngine.Cli/Commands/SharedOptionsFactory.cs
index 6754975c6a93..44828623944c 100644
--- a/src/Cli/Microsoft.TemplateEngine.Cli/Commands/SharedOptionsFactory.cs
+++ b/src/Cli/Microsoft.TemplateEngine.Cli/Commands/SharedOptionsFactory.cs
@@ -134,7 +134,7 @@ internal static Option CreateColumnsOption()
Description = SymbolStrings.Option_Columns,
AllowMultipleArgumentsPerToken = true,
};
- option.FromAmong(
+ option.AcceptOnlyFromAmong(
TabularOutputSettings.ColumnNames.Author,
TabularOutputSettings.ColumnNames.Language,
TabularOutputSettings.ColumnNames.Type,
diff --git a/src/Cli/Microsoft.TemplateEngine.Cli/Commands/create/InstantiateCommand.Help.cs b/src/Cli/Microsoft.TemplateEngine.Cli/Commands/create/InstantiateCommand.Help.cs
index 31d8fa358781..870e7cab0558 100644
--- a/src/Cli/Microsoft.TemplateEngine.Cli/Commands/create/InstantiateCommand.Help.cs
+++ b/src/Cli/Microsoft.TemplateEngine.Cli/Commands/create/InstantiateCommand.Help.cs
@@ -87,7 +87,7 @@ public static void WriteHelp(HelpContext context, InstantiateCommandArgs instant
ShowHintForOtherTemplates(templateGroup, preferredTemplate.Template, instantiateCommandArgs, context.Output);
}
- public IEnumerable CustomHelpLayout()
+ public IEnumerable> CustomHelpLayout()
{
yield return (context) =>
{
diff --git a/src/Cli/Microsoft.TemplateEngine.Cli/Commands/create/InstantiateCommandArgs.cs b/src/Cli/Microsoft.TemplateEngine.Cli/Commands/create/InstantiateCommandArgs.cs
index 6168fa8cbb16..095130d88675 100644
--- a/src/Cli/Microsoft.TemplateEngine.Cli/Commands/create/InstantiateCommandArgs.cs
+++ b/src/Cli/Microsoft.TemplateEngine.Cli/Commands/create/InstantiateCommandArgs.cs
@@ -11,8 +11,8 @@ internal class InstantiateCommandArgs : GlobalArgs
{
public InstantiateCommandArgs(InstantiateCommand command, ParseResult parseResult) : base(command, parseResult)
{
- RemainingArguments = parseResult.GetValueForArgument(command.RemainingArguments) ?? Array.Empty();
- ShortName = parseResult.GetValueForArgument(InstantiateCommand.ShortNameArgument);
+ RemainingArguments = parseResult.GetValue(command.RemainingArguments) ?? Array.Empty();
+ ShortName = parseResult.GetValue(InstantiateCommand.ShortNameArgument);
var tokens = new List();
if (!string.IsNullOrWhiteSpace(ShortName))
diff --git a/src/Cli/Microsoft.TemplateEngine.Cli/Commands/create/TemplateCommandArgs.cs b/src/Cli/Microsoft.TemplateEngine.Cli/Commands/create/TemplateCommandArgs.cs
index 777a3728c677..24c3044ea614 100644
--- a/src/Cli/Microsoft.TemplateEngine.Cli/Commands/create/TemplateCommandArgs.cs
+++ b/src/Cli/Microsoft.TemplateEngine.Cli/Commands/create/TemplateCommandArgs.cs
@@ -20,9 +20,9 @@ public TemplateCommandArgs(TemplateCommand command, BaseCommand parentCommand, P
RootCommand = GetRootCommand(parentCommand);
Name = parseResult.GetValueForOptionOrNull(SharedOptions.NameOption);
- IsForceFlagSpecified = parseResult.GetValueForOption(SharedOptions.ForceOption);
- IsDryRun = parseResult.GetValueForOption(SharedOptions.DryRunOption);
- NoUpdateCheck = parseResult.GetValueForOption(SharedOptions.NoUpdateCheckOption);
+ IsForceFlagSpecified = parseResult.GetValue(SharedOptions.ForceOption);
+ IsDryRun = parseResult.GetValue(SharedOptions.DryRunOption);
+ NoUpdateCheck = parseResult.GetValue(SharedOptions.NoUpdateCheckOption);
if (command.LanguageOption != null)
{
@@ -38,7 +38,7 @@ public TemplateCommandArgs(TemplateCommand command, BaseCommand parentCommand, P
}
if (command.AllowScriptsOption != null)
{
- AllowScripts = parseResult.GetValueForOption(command.AllowScriptsOption);
+ AllowScripts = parseResult.GetValue(command.AllowScriptsOption);
}
foreach (var opt in command.TemplateOptions)
@@ -73,7 +73,7 @@ public TemplateCommandArgs(TemplateCommand command, BaseCommand parentCommand, P
{
get
{
- return _templateOptions.Select(o => (o.Key, GetValueForOption(o.Key, o.Value)))
+ return _templateOptions.Select(o => (o.Key, GetValue(o.Key, o.Value)))
.Where(kvp => kvp.Item2 != null)
.ToDictionary(kvp => kvp.Key, kvp => kvp.Item2);
}
@@ -98,7 +98,7 @@ public bool TryGetAliasForCanonicalName(string canonicalName, out string? alias)
return false;
}
- private string? GetValueForOption(string parameterName, OptionResult optionResult)
+ private string? GetValue(string parameterName, OptionResult optionResult)
{
//if default value is used, no need to return it - it will be populated in template engine edge instead.
if (optionResult.IsImplicit)
diff --git a/src/Cli/Microsoft.TemplateEngine.Cli/Commands/install/InstallCommandArgs.cs b/src/Cli/Microsoft.TemplateEngine.Cli/Commands/install/InstallCommandArgs.cs
index 29d04cd295fc..0880e3c5881a 100644
--- a/src/Cli/Microsoft.TemplateEngine.Cli/Commands/install/InstallCommandArgs.cs
+++ b/src/Cli/Microsoft.TemplateEngine.Cli/Commands/install/InstallCommandArgs.cs
@@ -10,7 +10,7 @@ internal class InstallCommandArgs : GlobalArgs
{
public InstallCommandArgs(BaseInstallCommand installCommand, ParseResult parseResult) : base(installCommand, parseResult)
{
- TemplatePackages = parseResult.GetValueForArgument(InstallCommand.NameArgument)
+ TemplatePackages = parseResult.GetValue(InstallCommand.NameArgument)
?? throw new ArgumentException($"{nameof(parseResult)} should contain at least one argument for {nameof(InstallCommand.NameArgument)}", nameof(parseResult));
//workaround for --install source1 --install source2 case
@@ -24,9 +24,9 @@ public InstallCommandArgs(BaseInstallCommand installCommand, ParseResult parseRe
throw new ArgumentException($"{nameof(parseResult)} should contain at least one argument for {nameof(InstallCommand.NameArgument)}", nameof(parseResult));
}
- Interactive = parseResult.GetValueForOption(installCommand.InteractiveOption);
- AdditionalSources = parseResult.GetValueForOption(installCommand.AddSourceOption);
- Force = parseResult.GetValueForOption(BaseInstallCommand.ForceOption);
+ Interactive = parseResult.GetValue(installCommand.InteractiveOption);
+ AdditionalSources = parseResult.GetValue(installCommand.AddSourceOption);
+ Force = parseResult.GetValue(BaseInstallCommand.ForceOption);
}
public IReadOnlyList TemplatePackages { get; }
diff --git a/src/Cli/Microsoft.TemplateEngine.Cli/Commands/list/ListCommandArgs.cs b/src/Cli/Microsoft.TemplateEngine.Cli/Commands/list/ListCommandArgs.cs
index c03fee87f875..37422bfb3deb 100644
--- a/src/Cli/Microsoft.TemplateEngine.Cli/Commands/list/ListCommandArgs.cs
+++ b/src/Cli/Microsoft.TemplateEngine.Cli/Commands/list/ListCommandArgs.cs
@@ -10,7 +10,7 @@ internal class ListCommandArgs : BaseFilterableArgs, ITabularOutputArgs
{
internal ListCommandArgs(BaseListCommand command, ParseResult parseResult) : base(command, parseResult)
{
- string? nameCriteria = parseResult.GetValueForArgument(ListCommand.NameArgument);
+ string? nameCriteria = parseResult.GetValue(ListCommand.NameArgument);
if (!string.IsNullOrWhiteSpace(nameCriteria))
{
ListNameCriteria = nameCriteria;
@@ -18,7 +18,7 @@ internal ListCommandArgs(BaseListCommand command, ParseResult parseResult) : bas
// for legacy case new command argument is also accepted
else if (command is LegacyListCommand legacySearchCommand)
{
- string? newCommandArgument = parseResult.GetValueForArgument(NewCommand.ShortNameArgument);
+ string? newCommandArgument = parseResult.GetValue(NewCommand.ShortNameArgument);
if (!string.IsNullOrWhiteSpace(newCommandArgument))
{
ListNameCriteria = newCommandArgument;
@@ -29,7 +29,7 @@ internal ListCommandArgs(BaseListCommand command, ParseResult parseResult) : bas
{
Language = GetFilterValue(FilterOptionDefinition.LanguageFilter);
}
- IgnoreConstraints = parseResult.GetValueForOption(ListCommand.IgnoreConstraintsOption);
+ IgnoreConstraints = parseResult.GetValue(ListCommand.IgnoreConstraintsOption);
}
public bool DisplayAllColumns { get; }
diff --git a/src/Cli/Microsoft.TemplateEngine.Cli/Commands/search/SearchCommandArgs.cs b/src/Cli/Microsoft.TemplateEngine.Cli/Commands/search/SearchCommandArgs.cs
index 15ab2408a03a..b970ce01e10f 100644
--- a/src/Cli/Microsoft.TemplateEngine.Cli/Commands/search/SearchCommandArgs.cs
+++ b/src/Cli/Microsoft.TemplateEngine.Cli/Commands/search/SearchCommandArgs.cs
@@ -10,7 +10,7 @@ internal class SearchCommandArgs : BaseFilterableArgs, ITabularOutputArgs
{
internal SearchCommandArgs(BaseSearchCommand command, ParseResult parseResult) : base(command, parseResult)
{
- string? nameCriteria = parseResult.GetValueForArgument(BaseSearchCommand.NameArgument);
+ string? nameCriteria = parseResult.GetValue(BaseSearchCommand.NameArgument);
if (!string.IsNullOrWhiteSpace(nameCriteria))
{
SearchNameCriteria = nameCriteria;
@@ -18,7 +18,7 @@ internal SearchCommandArgs(BaseSearchCommand command, ParseResult parseResult) :
// for legacy case new command argument is also accepted
else if (command is LegacySearchCommand legacySearchCommand)
{
- string? newCommandArgument = parseResult.GetValueForArgument(NewCommand.ShortNameArgument);
+ string? newCommandArgument = parseResult.GetValue(NewCommand.ShortNameArgument);
if (!string.IsNullOrWhiteSpace(newCommandArgument))
{
SearchNameCriteria = newCommandArgument;
diff --git a/src/Cli/Microsoft.TemplateEngine.Cli/Commands/uninstall/UninstallCommandArgs.cs b/src/Cli/Microsoft.TemplateEngine.Cli/Commands/uninstall/UninstallCommandArgs.cs
index 13d3a1d9fefc..c9391d25da5d 100644
--- a/src/Cli/Microsoft.TemplateEngine.Cli/Commands/uninstall/UninstallCommandArgs.cs
+++ b/src/Cli/Microsoft.TemplateEngine.Cli/Commands/uninstall/UninstallCommandArgs.cs
@@ -10,7 +10,7 @@ internal class UninstallCommandArgs : GlobalArgs
{
public UninstallCommandArgs(BaseUninstallCommand uninstallCommand, ParseResult parseResult) : base(uninstallCommand, parseResult)
{
- TemplatePackages = parseResult.GetValueForArgument(BaseUninstallCommand.NameArgument) ?? Array.Empty();
+ TemplatePackages = parseResult.GetValue(BaseUninstallCommand.NameArgument) ?? Array.Empty();
//workaround for --install source1 --install source2 case
if (uninstallCommand is LegacyUninstallCommand && uninstallCommand.Aliases.Any(alias => TemplatePackages.Contains(alias)))
diff --git a/src/Cli/Microsoft.TemplateEngine.Cli/Commands/update/UpdateCommandArgs.cs b/src/Cli/Microsoft.TemplateEngine.Cli/Commands/update/UpdateCommandArgs.cs
index 42e6251775f8..79d0dc8da93b 100644
--- a/src/Cli/Microsoft.TemplateEngine.Cli/Commands/update/UpdateCommandArgs.cs
+++ b/src/Cli/Microsoft.TemplateEngine.Cli/Commands/update/UpdateCommandArgs.cs
@@ -12,7 +12,7 @@ public UpdateCommandArgs(BaseUpdateCommand command, ParseResult parseResult) : b
{
if (command is UpdateCommand updateCommand)
{
- CheckOnly = parseResult.GetValueForOption(UpdateCommand.CheckOnlyOption);
+ CheckOnly = parseResult.GetValue(UpdateCommand.CheckOnlyOption);
}
else if (command is LegacyUpdateCheckCommand)
{
@@ -27,8 +27,8 @@ public UpdateCommandArgs(BaseUpdateCommand command, ParseResult parseResult) : b
throw new ArgumentException($"Unsupported type {command.GetType().FullName}", nameof(command));
}
- Interactive = parseResult.GetValueForOption(command.InteractiveOption);
- AdditionalSources = parseResult.GetValueForOption(command.AddSourceOption);
+ Interactive = parseResult.GetValue(command.InteractiveOption);
+ AdditionalSources = parseResult.GetValue(command.AddSourceOption);
}
public bool CheckOnly { get; }
diff --git a/src/Cli/dotnet-new3/CompleteCommand.cs b/src/Cli/dotnet-new3/CompleteCommand.cs
index 0be134c5c57a..e5c8c07e480b 100644
--- a/src/Cli/dotnet-new3/CompleteCommand.cs
+++ b/src/Cli/dotnet-new3/CompleteCommand.cs
@@ -35,8 +35,8 @@ public Task Run(ParseResult result)
{
try
{
- var input = result.GetValueForArgument(PathArgument) ?? string.Empty;
- var position = result.GetValueForOption(PositionOption);
+ var input = result.GetValue(PathArgument) ?? string.Empty;
+ var position = result.GetValue(PositionOption);
if (position > input.Length)
{
diff --git a/src/Cli/dotnet-new3/New3CommandFactory.cs b/src/Cli/dotnet-new3/New3CommandFactory.cs
index c5759d3594f5..5ab2e0e616c9 100644
--- a/src/Cli/dotnet-new3/New3CommandFactory.cs
+++ b/src/Cli/dotnet-new3/New3CommandFactory.cs
@@ -28,8 +28,8 @@ internal static Command Create()
CommandName,
(ParseResult parseResult) =>
{
- FileInfo? outputPath = parseResult.GetValueForOption(SharedOptions.OutputOption);
- return HostFactory.CreateHost(parseResult.GetValueForOption(_debugDisableBuiltInTemplatesOption), outputPath?.FullName);
+ FileInfo? outputPath = parseResult.GetValue(SharedOptions.OutputOption);
+ return HostFactory.CreateHost(parseResult.GetValue(_debugDisableBuiltInTemplatesOption), outputPath?.FullName);
});
newCommand.AddGlobalOption(_debugEmitTelemetryOption);
diff --git a/src/Cli/dotnet-new3/ParserFactory.cs b/src/Cli/dotnet-new3/ParserFactory.cs
index fa8b6b18d2ec..4ed2d8277c24 100644
--- a/src/Cli/dotnet-new3/ParserFactory.cs
+++ b/src/Cli/dotnet-new3/ParserFactory.cs
@@ -29,7 +29,7 @@ internal static Parser CreateParser(Command command, bool disableHelp = false)
return builder.Build();
}
- private static IEnumerable CustomHelpLayout(HelpContext context)
+ private static IEnumerable> CustomHelpLayout(HelpContext context)
{
if (context.ParseResult.CommandResult.Command is ICustomHelp custom)
{
diff --git a/src/Cli/dotnet/CommonOptions.cs b/src/Cli/dotnet/CommonOptions.cs
index 9426b8c09dd6..8e9297557bc4 100644
--- a/src/Cli/dotnet/CommonOptions.cs
+++ b/src/Cli/dotnet/CommonOptions.cs
@@ -53,7 +53,7 @@ public static Option FrameworkOption(string description) =>
private static string RuntimeArgName = CommonLocalizableStrings.RuntimeIdentifierArgumentName;
private static Func> RuntimeArgFunc = o => new string[] { $"-property:RuntimeIdentifier={o}", "-property:_CommandLineDefinedRuntimeIdentifier=true" };
- private static CompletionDelegate RuntimeCompletions = Complete.RunTimesFromProjectFile;
+ private static Func> RuntimeCompletions = Complete.RunTimesFromProjectFile;
public static Option RuntimeOption =
new ForwardedOption(
@@ -135,9 +135,9 @@ public static Argument DefaultToCurrentDirectory(this Argument arg)
.SetForwardingFunction(ResolveArchOptionToRuntimeIdentifier);
internal static string ArchOptionValue(ParseResult parseResult) =>
- string.IsNullOrEmpty(parseResult.GetValueForOption(CommonOptions.ArchitectureOption)) ?
- parseResult.GetValueForOption(CommonOptions.LongFormArchitectureOption) :
- parseResult.GetValueForOption(CommonOptions.ArchitectureOption);
+ string.IsNullOrEmpty(parseResult.GetValue(CommonOptions.ArchitectureOption)) ?
+ parseResult.GetValue(CommonOptions.LongFormArchitectureOption) :
+ parseResult.GetValue(CommonOptions.ArchitectureOption);
public static Option OperatingSystemOption =
new ForwardedOption(
diff --git a/src/Cli/dotnet/NugetSearch/NugetSearchApiParameter.cs b/src/Cli/dotnet/NugetSearch/NugetSearchApiParameter.cs
index 55a4a7eba93f..b3cbe362b733 100644
--- a/src/Cli/dotnet/NugetSearch/NugetSearchApiParameter.cs
+++ b/src/Cli/dotnet/NugetSearch/NugetSearchApiParameter.cs
@@ -29,11 +29,11 @@ public NugetSearchApiParameter(
public NugetSearchApiParameter(ParseResult parseResult)
{
- var searchTerm = parseResult.GetValueForArgument(ToolSearchCommandParser.SearchTermArgument);
+ var searchTerm = parseResult.GetValue(ToolSearchCommandParser.SearchTermArgument);
var skip = GetParsedResultAsInt(parseResult, ToolSearchCommandParser.SkipOption);
var take = GetParsedResultAsInt(parseResult, ToolSearchCommandParser.TakeOption);
- var prerelease = parseResult.GetValueForOption(ToolSearchCommandParser.PrereleaseOption);
+ var prerelease = parseResult.GetValue(ToolSearchCommandParser.PrereleaseOption);
SearchTerm = searchTerm;
Skip = skip;
@@ -43,7 +43,7 @@ public NugetSearchApiParameter(ParseResult parseResult)
private static int? GetParsedResultAsInt(ParseResult parseResult, Option alias)
{
- var valueFromParser = parseResult.GetValueForOption(alias);
+ var valueFromParser = parseResult.GetValue(alias);
if (string.IsNullOrWhiteSpace(valueFromParser))
{
return null;
diff --git a/src/Cli/dotnet/OptionForwardingExtensions.cs b/src/Cli/dotnet/OptionForwardingExtensions.cs
index 3aaedbbcdfc9..5f83d4981d5c 100644
--- a/src/Cli/dotnet/OptionForwardingExtensions.cs
+++ b/src/Cli/dotnet/OptionForwardingExtensions.cs
@@ -94,7 +94,7 @@ public ForwardedOption(string[] aliases) : base(aliases) { }
public ForwardedOption(string alias, string description = null) : base(alias, description) { }
- public ForwardedOption(string alias, ParseArgument parseArgument, string description = null) :
+ public ForwardedOption(string alias, Func parseArgument, string description = null) :
base(alias, parseArgument, description: description) { }
public ForwardedOption SetForwardingFunction(Func> func)
@@ -111,13 +111,13 @@ public ForwardedOption SetForwardingFunction(Func format)
public ForwardedOption SetForwardingFunction(Func> func)
{
- ForwardingFunction = (ParseResult parseResult) => parseResult.HasOption(this) ? func(parseResult.GetValueForOption(this), parseResult) : Array.Empty();
+ ForwardingFunction = (ParseResult parseResult) => parseResult.HasOption(this) ? func(parseResult.GetValue(this), parseResult) : Array.Empty();
return this;
}
public Func> GetForwardingFunction(Func> func)
{
- return (ParseResult parseResult) => parseResult.HasOption(this) ? func(parseResult.GetValueForOption(this)) : Array.Empty();
+ return (ParseResult parseResult) => parseResult.HasOption(this) ? func(parseResult.GetValue(this)) : Array.Empty();
}
public Func> GetForwardingFunction()
diff --git a/src/Cli/dotnet/ParseResultExtensions.cs b/src/Cli/dotnet/ParseResultExtensions.cs
index 0e93cc7d9e00..41353fd99d3b 100644
--- a/src/Cli/dotnet/ParseResultExtensions.cs
+++ b/src/Cli/dotnet/ParseResultExtensions.cs
@@ -73,7 +73,7 @@ public static bool CanBeInvoked(this ParseResult parseResult)
{
return Parser.GetBuiltInCommand(parseResult.RootSubCommandResult()) != null ||
parseResult.Directives.Count() > 0 ||
- (parseResult.IsTopLevelDotnetCommand() && string.IsNullOrEmpty(parseResult.GetValueForArgument(Parser.DotnetSubCommand)));
+ (parseResult.IsTopLevelDotnetCommand() && string.IsNullOrEmpty(parseResult.GetValue(Parser.DotnetSubCommand)));
}
public static int HandleMissingCommand(this ParseResult parseResult)
@@ -135,19 +135,19 @@ public static bool BothArchAndOsOptionsSpecified(this ParseResult parseResult) =
internal static string GetCommandLineRuntimeIdentifier(this ParseResult parseResult)
{
return parseResult.HasOption(RunCommandParser.RuntimeOption) ?
- parseResult.GetValueForOption(RunCommandParser.RuntimeOption) :
+ parseResult.GetValue(RunCommandParser.RuntimeOption) :
parseResult.HasOption(CommonOptions.OperatingSystemOption) ||
parseResult.HasOption(CommonOptions.ArchitectureOption) ||
parseResult.HasOption(CommonOptions.LongFormArchitectureOption) ?
CommonOptions.ResolveRidShorthandOptionsToRuntimeIdentifier(
- parseResult.GetValueForOption(CommonOptions.OperatingSystemOption),
+ parseResult.GetValue(CommonOptions.OperatingSystemOption),
CommonOptions.ArchOptionValue(parseResult)) :
null;
}
public static bool UsingRunCommandShorthandProjectOption(this ParseResult parseResult)
{
- if (parseResult.HasOption(RunCommandParser.PropertyOption) && parseResult.GetValueForOption(RunCommandParser.PropertyOption).Any())
+ if (parseResult.HasOption(RunCommandParser.PropertyOption) && parseResult.GetValue(RunCommandParser.PropertyOption).Any())
{
var projVals = parseResult.GetRunCommandShorthandProjectValues();
if (projVals.Any())
@@ -205,7 +205,7 @@ public static object SafelyGetValueForOption(this ParseResult parseResult, Optio
if (parseResult.FindResultFor(optionToGet) is OptionResult optionResult &&
!parseResult.Errors.Any(e => e.SymbolResult == optionResult))
{
- return optionResult.GetValueForOption(optionToGet);
+ return optionResult.GetValue(optionToGet);
}
else {
return default;
@@ -223,7 +223,7 @@ public static T SafelyGetValueForOption(this ParseResult parseResult, Option<
if (parseResult.FindResultFor(optionToGet) is OptionResult optionResult &&
!parseResult.Errors.Any(e => e.SymbolResult == optionResult))
{
- return optionResult.GetValueForOption(optionToGet);
+ return optionResult.GetValue(optionToGet);
}
else {
return default;
diff --git a/src/Cli/dotnet/Parser.cs b/src/Cli/dotnet/Parser.cs
index 546b10740209..537aa5e893b7 100644
--- a/src/Cli/dotnet/Parser.cs
+++ b/src/Cli/dotnet/Parser.cs
@@ -303,7 +303,7 @@ public override void Write(HelpContext context)
}
else if (command.Name.Equals(FormatCommandParser.GetCommand().Name))
{
- var argumetns = context.ParseResult.GetValueForArgument(FormatCommandParser.Arguments);
+ var argumetns = context.ParseResult.GetValue(FormatCommandParser.Arguments);
new DotnetFormatForwardingApp(argumetns.Concat(helpArgs).ToArray()).Execute();
}
else if (command.Name.Equals(FsiCommandParser.GetCommand().Name))
diff --git a/src/Cli/dotnet/Program.cs b/src/Cli/dotnet/Program.cs
index cb95a3843fb3..f6ded3cbabea 100644
--- a/src/Cli/dotnet/Program.cs
+++ b/src/Cli/dotnet/Program.cs
@@ -143,7 +143,7 @@ internal static int ProcessArgs(string[] args, TimeSpan startupTime, ITelemetry
Path.Combine(
CliFolderPathCalculator.DotnetUserProfileFolderPath,
ToolPathSentinelFileName)));
- if (parseResult.GetValueForOption(Parser.DiagOption) && parseResult.IsDotnetBuiltInCommand())
+ if (parseResult.GetValue(Parser.DiagOption) && parseResult.IsDotnetBuiltInCommand())
{
Environment.SetEnvironmentVariable(CommandLoggingContext.Variables.Verbose, bool.TrueString);
CommandLoggingContext.SetVerbose(true);
@@ -234,7 +234,7 @@ internal static int ProcessArgs(string[] args, TimeSpan startupTime, ITelemetry
{
PerformanceLogEventSource.Log.ExtensibleCommandResolverStart();
var resolvedCommand = CommandFactoryUsingResolver.Create(
- "dotnet-" + parseResult.GetValueForArgument(Parser.DotnetSubCommand),
+ "dotnet-" + parseResult.GetValue(Parser.DotnetSubCommand),
args.GetSubArguments(),
FrameworkConstants.CommonFrameworks.NetStandardApp15);
PerformanceLogEventSource.Log.ExtensibleCommandResolverStop();
diff --git a/src/Cli/dotnet/ReleasePropertyProjectLocator.cs b/src/Cli/dotnet/ReleasePropertyProjectLocator.cs
index 52aac61ab583..b54e81a88d67 100644
--- a/src/Cli/dotnet/ReleasePropertyProjectLocator.cs
+++ b/src/Cli/dotnet/ReleasePropertyProjectLocator.cs
@@ -189,7 +189,7 @@ private Dictionary GetGlobalPropertiesFromUserArgs(ParseResult p
{
Dictionary globalProperties = new Dictionary(StringComparer.OrdinalIgnoreCase);
- string[] globalPropEnumerable = parseResult.GetValueForOption(CommonOptions.PropertiesOption);
+ string[] globalPropEnumerable = parseResult.GetValue(CommonOptions.PropertiesOption);
foreach (var keyEqVal in globalPropEnumerable)
{
diff --git a/src/Cli/dotnet/commands/InstallingWorkloadCommand.cs b/src/Cli/dotnet/commands/InstallingWorkloadCommand.cs
index 52c7432fb321..89c8734b5041 100644
--- a/src/Cli/dotnet/commands/InstallingWorkloadCommand.cs
+++ b/src/Cli/dotnet/commands/InstallingWorkloadCommand.cs
@@ -59,21 +59,21 @@ public InstallingWorkloadCommand(
string installedFeatureBand = null)
: base(parseResult, reporter: reporter, tempDirPath: tempDirPath, nugetPackageDownloader: nugetPackageDownloader)
{
- _printDownloadLinkOnly = parseResult.GetValueForOption(InstallingWorkloadCommandParser.PrintDownloadLinkOnlyOption);
- _fromCacheOption = parseResult.GetValueForOption(InstallingWorkloadCommandParser.FromCacheOption);
- _includePreviews = parseResult.GetValueForOption(InstallingWorkloadCommandParser.IncludePreviewOption);
- _downloadToCacheOption = parseResult.GetValueForOption(InstallingWorkloadCommandParser.DownloadToCacheOption);
+ _printDownloadLinkOnly = parseResult.GetValue(InstallingWorkloadCommandParser.PrintDownloadLinkOnlyOption);
+ _fromCacheOption = parseResult.GetValue(InstallingWorkloadCommandParser.FromCacheOption);
+ _includePreviews = parseResult.GetValue(InstallingWorkloadCommandParser.IncludePreviewOption);
+ _downloadToCacheOption = parseResult.GetValue(InstallingWorkloadCommandParser.DownloadToCacheOption);
_dotnetPath = dotnetDir ?? Path.GetDirectoryName(Environment.ProcessPath);
_userProfileDir = userProfileDir ?? CliFolderPathCalculator.DotnetUserProfileFolderPath;
_checkIfManifestExist = !(_printDownloadLinkOnly); // don't check for manifest existence when print download link is passed
- _sdkVersion = WorkloadOptionsExtensions.GetValidatedSdkVersion(parseResult.GetValueForOption(InstallingWorkloadCommandParser.VersionOption), version, _dotnetPath, _userProfileDir, _checkIfManifestExist);
+ _sdkVersion = WorkloadOptionsExtensions.GetValidatedSdkVersion(parseResult.GetValue(InstallingWorkloadCommandParser.VersionOption), version, _dotnetPath, _userProfileDir, _checkIfManifestExist);
_sdkFeatureBand = new SdkFeatureBand(_sdkVersion);
_installedSdkVersion = new ReleaseVersion(version ?? Product.Version);
_installedFeatureBand = new SdkFeatureBand(installedFeatureBand ?? Product.Version);
- _fromRollbackDefinition = parseResult.GetValueForOption(InstallingWorkloadCommandParser.FromRollbackFileOption);
- var configOption = parseResult.GetValueForOption(InstallingWorkloadCommandParser.ConfigOption);
- var sourceOption = parseResult.GetValueForOption(InstallingWorkloadCommandParser.SourceOption);
+ _fromRollbackDefinition = parseResult.GetValue(InstallingWorkloadCommandParser.FromRollbackFileOption);
+ var configOption = parseResult.GetValue(InstallingWorkloadCommandParser.ConfigOption);
+ var sourceOption = parseResult.GetValue(InstallingWorkloadCommandParser.SourceOption);
_packageSourceLocation = string.IsNullOrEmpty(configOption) && (sourceOption == null || !sourceOption.Any()) ? null :
new PackageSourceLocation(string.IsNullOrEmpty(configOption) ? null : new FilePath(configOption), sourceFeedOverrides: sourceOption);
diff --git a/src/Cli/dotnet/commands/dotnet-add/dotnet-add-package/AddPackageParser.cs b/src/Cli/dotnet/commands/dotnet-add/dotnet-add-package/AddPackageParser.cs
index 9635755cc265..a9a52b193e80 100644
--- a/src/Cli/dotnet/commands/dotnet-add/dotnet-add-package/AddPackageParser.cs
+++ b/src/Cli/dotnet/commands/dotnet-add/dotnet-add-package/AddPackageParser.cs
@@ -5,8 +5,6 @@
using System.Collections.Generic;
using System.CommandLine;
using System.CommandLine.Completions;
-using System.CommandLine.Invocation;
-using System.CommandLine.Parsing;
using System.IO;
using System.Linq;
using System.Net.Http;
diff --git a/src/Cli/dotnet/commands/dotnet-add/dotnet-add-package/Program.cs b/src/Cli/dotnet/commands/dotnet-add/dotnet-add-package/Program.cs
index 83255b103027..bb13349234b2 100644
--- a/src/Cli/dotnet/commands/dotnet-add/dotnet-add-package/Program.cs
+++ b/src/Cli/dotnet/commands/dotnet-add/dotnet-add-package/Program.cs
@@ -22,8 +22,8 @@ internal class AddPackageReferenceCommand : CommandBase
public AddPackageReferenceCommand(
ParseResult parseResult) : base(parseResult)
{
- _fileOrDirectory = parseResult.GetValueForArgument(AddCommandParser.ProjectArgument);
- _packageId = parseResult.GetValueForArgument(AddPackageParser.CmdPackageArgument);
+ _fileOrDirectory = parseResult.GetValue(AddCommandParser.ProjectArgument);
+ _packageId = parseResult.GetValue(AddPackageParser.CmdPackageArgument);
}
public override int Execute()
diff --git a/src/Cli/dotnet/commands/dotnet-add/dotnet-add-reference/Program.cs b/src/Cli/dotnet/commands/dotnet-add/dotnet-add-reference/Program.cs
index 31f112f63ca3..b03141ee360b 100644
--- a/src/Cli/dotnet/commands/dotnet-add/dotnet-add-reference/Program.cs
+++ b/src/Cli/dotnet/commands/dotnet-add/dotnet-add-reference/Program.cs
@@ -22,21 +22,21 @@ internal class AddProjectToProjectReferenceCommand : CommandBase
public AddProjectToProjectReferenceCommand(ParseResult parseResult) : base(parseResult)
{
- _fileOrDirectory = parseResult.GetValueForArgument(AddCommandParser.ProjectArgument);
+ _fileOrDirectory = parseResult.GetValue(AddCommandParser.ProjectArgument);
}
public override int Execute()
{
var projects = new ProjectCollection();
- bool interactive = _parseResult.GetValueForOption(AddProjectToProjectReferenceParser.InteractiveOption);
+ bool interactive = _parseResult.GetValue(AddProjectToProjectReferenceParser.InteractiveOption);
MsbuildProject msbuildProj = MsbuildProject.FromFileOrDirectory(
projects,
_fileOrDirectory,
interactive);
- var frameworkString = _parseResult.GetValueForOption(AddProjectToProjectReferenceParser.FrameworkOption);
+ var frameworkString = _parseResult.GetValue(AddProjectToProjectReferenceParser.FrameworkOption);
- var arguments = _parseResult.GetValueForArgument(AddProjectToProjectReferenceParser.ProjectPathArgument).ToList().AsReadOnly();
+ var arguments = _parseResult.GetValue(AddProjectToProjectReferenceParser.ProjectPathArgument).ToList().AsReadOnly();
PathUtility.EnsureAllPathsExist(arguments,
CommonLocalizableStrings.CouldNotFindProjectOrDirectory, true);
List refs =
diff --git a/src/Cli/dotnet/commands/dotnet-build/BuildCommand.cs b/src/Cli/dotnet/commands/dotnet-build/BuildCommand.cs
index 92e5a51f9777..d7fc1097c89a 100644
--- a/src/Cli/dotnet/commands/dotnet-build/BuildCommand.cs
+++ b/src/Cli/dotnet/commands/dotnet-build/BuildCommand.cs
@@ -44,7 +44,7 @@ public static BuildCommand FromParseResult(ParseResult parseResult, string msbui
{
msbuildArgs.Add("-target:Rebuild");
}
- var arguments = parseResult.GetValueForArgument(BuildCommandParser.SlnOrProjectArgument) ?? Array.Empty();
+ var arguments = parseResult.GetValue(BuildCommandParser.SlnOrProjectArgument) ?? Array.Empty();
msbuildArgs.AddRange(parseResult.OptionValuesToBeForwarded(BuildCommandParser.GetCommand()));
diff --git a/src/Cli/dotnet/commands/dotnet-buildserver/shutdown/BuildServerShutdownCommand.cs b/src/Cli/dotnet/commands/dotnet-buildserver/shutdown/BuildServerShutdownCommand.cs
index 0fccc96f596f..3a147e303171 100644
--- a/src/Cli/dotnet/commands/dotnet-buildserver/shutdown/BuildServerShutdownCommand.cs
+++ b/src/Cli/dotnet/commands/dotnet-buildserver/shutdown/BuildServerShutdownCommand.cs
@@ -28,9 +28,9 @@ public BuildServerShutdownCommand(
IReporter reporter = null)
: base(result)
{
- bool msbuild = result.GetValueForOption(ServerShutdownCommandParser.MSBuildOption);
- bool vbcscompiler = result.GetValueForOption(ServerShutdownCommandParser.VbcsOption);
- bool razor = result.GetValueForOption(ServerShutdownCommandParser.RazorOption);
+ bool msbuild = result.GetValue(ServerShutdownCommandParser.MSBuildOption);
+ bool vbcscompiler = result.GetValue(ServerShutdownCommandParser.VbcsOption);
+ bool razor = result.GetValue(ServerShutdownCommandParser.RazorOption);
bool all = !msbuild && !vbcscompiler && !razor;
_enumerationFlags = ServerEnumerationFlags.None;
diff --git a/src/Cli/dotnet/commands/dotnet-clean/Program.cs b/src/Cli/dotnet/commands/dotnet-clean/Program.cs
index bdcf8e4b2c87..0188802297d8 100644
--- a/src/Cli/dotnet/commands/dotnet-clean/Program.cs
+++ b/src/Cli/dotnet/commands/dotnet-clean/Program.cs
@@ -35,7 +35,7 @@ public static CleanCommand FromParseResult(ParseResult result, string msbuildPat
result.ShowHelpOrErrorIfAppropriate();
- msbuildArgs.AddRange(result.GetValueForArgument(CleanCommandParser.SlnOrProjectArgument) ?? Array.Empty());
+ msbuildArgs.AddRange(result.GetValue(CleanCommandParser.SlnOrProjectArgument) ?? Array.Empty());
msbuildArgs.Add("-target:Clean");
diff --git a/src/Cli/dotnet/commands/dotnet-complete/Complete.cs b/src/Cli/dotnet/commands/dotnet-complete/Complete.cs
index b629e65c1826..4aa29b5eb30b 100644
--- a/src/Cli/dotnet/commands/dotnet-complete/Complete.cs
+++ b/src/Cli/dotnet/commands/dotnet-complete/Complete.cs
@@ -11,6 +11,7 @@
using Microsoft.DotNet.Cli.Utils;
using Microsoft.DotNet.Tools;
using static System.Array;
+using System.Collections.Generic;
namespace Microsoft.DotNet.Cli
{
@@ -19,7 +20,7 @@ internal static class Complete
private static CompletionItem ToCompletionItem (string s) => new CompletionItem(s);
- public static CompletionDelegate TargetFrameworksFromProjectFile =>
+ public static Func> TargetFrameworksFromProjectFile =>
(_context) =>
{
try
@@ -35,7 +36,7 @@ internal static class Complete
private static void Report(Exception e) =>
Reporter.Verbose.WriteLine($"Exception occurred while getting completions: {e}");
- public static CompletionDelegate RunTimesFromProjectFile =>
+ public static Func> RunTimesFromProjectFile =>
(_context) =>
{
try
@@ -48,7 +49,7 @@ private static void Report(Exception e) =>
}
};
- public static CompletionDelegate ProjectReferencesFromProjectFile =>
+ public static Func> ProjectReferencesFromProjectFile =>
(_context) =>
{
try
@@ -61,7 +62,7 @@ private static void Report(Exception e) =>
}
};
- public static CompletionDelegate ConfigurationsFromProjectFileOrDefaults =>
+ public static Func> ConfigurationsFromProjectFileOrDefaults =>
(_context) =>
{
try
diff --git a/src/Cli/dotnet/commands/dotnet-complete/CompleteCommand.cs b/src/Cli/dotnet/commands/dotnet-complete/CompleteCommand.cs
index 2686c273fc01..74bd29393532 100644
--- a/src/Cli/dotnet/commands/dotnet-complete/CompleteCommand.cs
+++ b/src/Cli/dotnet/commands/dotnet-complete/CompleteCommand.cs
@@ -52,9 +52,9 @@ public static int RunWithReporter(ParseResult result, IReporter reporter)
private static CompletionItem[] Completions(ParseResult complete)
{
- var input = complete.GetValueForArgument(CompleteCommandParser.PathArgument) ?? string.Empty;
+ var input = complete.GetValue(CompleteCommandParser.PathArgument) ?? string.Empty;
- var position = complete.GetValueForOption(CompleteCommandParser.PositionOption);
+ var position = complete.GetValue(CompleteCommandParser.PositionOption);
if (position > input.Length)
{
diff --git a/src/Cli/dotnet/commands/dotnet-format/FormatCommand.cs b/src/Cli/dotnet/commands/dotnet-format/FormatCommand.cs
index 3db9982a28fd..5790fa885e8b 100644
--- a/src/Cli/dotnet/commands/dotnet-format/FormatCommand.cs
+++ b/src/Cli/dotnet/commands/dotnet-format/FormatCommand.cs
@@ -23,7 +23,7 @@ public static FormatCommand FromArgs(string[] args)
public static FormatCommand FromParseResult(ParseResult result)
{
- return new FormatCommand(result.GetValueForArgument(FormatCommandParser.Arguments));
+ return new FormatCommand(result.GetValue(FormatCommandParser.Arguments));
}
public static int Run(ParseResult parseResult)
diff --git a/src/Cli/dotnet/commands/dotnet-format/FormatCommandParser.cs b/src/Cli/dotnet/commands/dotnet-format/FormatCommandParser.cs
index b07424c28f8f..973af19c4b0a 100644
--- a/src/Cli/dotnet/commands/dotnet-format/FormatCommandParser.cs
+++ b/src/Cli/dotnet/commands/dotnet-format/FormatCommandParser.cs
@@ -25,7 +25,7 @@ private static Command ConstructCommand()
{
Arguments
};
- formatCommand.SetHandler((ParseResult parseResult) => FormatCommand.Run(parseResult.GetValueForArgument(Arguments)));
+ formatCommand.SetHandler((ParseResult parseResult) => FormatCommand.Run(parseResult.GetValue(Arguments)));
return formatCommand;
}
}
diff --git a/src/Cli/dotnet/commands/dotnet-fsi/FsiCommandParser.cs b/src/Cli/dotnet/commands/dotnet-fsi/FsiCommandParser.cs
index 596d251b81bf..346298fab6f6 100644
--- a/src/Cli/dotnet/commands/dotnet-fsi/FsiCommandParser.cs
+++ b/src/Cli/dotnet/commands/dotnet-fsi/FsiCommandParser.cs
@@ -24,7 +24,7 @@ private static Command ConstructCommand()
{
var command = new DocumentedCommand("fsi", DocsLink) { Arguments };
- command.SetHandler((ParseResult parseResult) => FsiCommand.Run(parseResult.GetValueForArgument(Arguments)));
+ command.SetHandler((ParseResult parseResult) => FsiCommand.Run(parseResult.GetValue(Arguments)));
return command;
}
diff --git a/src/Cli/dotnet/commands/dotnet-help/HelpCommand.cs b/src/Cli/dotnet/commands/dotnet-help/HelpCommand.cs
index b3ef020f6fc5..f4fe5c282231 100644
--- a/src/Cli/dotnet/commands/dotnet-help/HelpCommand.cs
+++ b/src/Cli/dotnet/commands/dotnet-help/HelpCommand.cs
@@ -26,7 +26,7 @@ public static int Run(ParseResult result)
result.ShowHelpOrErrorIfAppropriate();
- if (!string.IsNullOrEmpty(result.GetValueForArgument(HelpCommandParser.Argument)))
+ if (!string.IsNullOrEmpty(result.GetValue(HelpCommandParser.Argument)))
{
return new HelpCommand(result).Execute();
}
@@ -84,7 +84,7 @@ public static Process ConfigureProcess(string docUrl)
public int Execute()
{
if (TryGetDocsLink(
- _parseResult.GetValueForArgument(HelpCommandParser.Argument),
+ _parseResult.GetValue(HelpCommandParser.Argument),
out var docsLink) &&
!string.IsNullOrEmpty(docsLink))
{
@@ -98,7 +98,7 @@ public int Execute()
Reporter.Error.WriteLine(
string.Format(
LocalizableStrings.CommandDoesNotExist,
- _parseResult.GetValueForArgument(HelpCommandParser.Argument)).Red());
+ _parseResult.GetValue(HelpCommandParser.Argument)).Red());
Reporter.Output.WriteLine(HelpUsageText.UsageText);
return 1;
}
diff --git a/src/Cli/dotnet/commands/dotnet-internal-reportinstallsuccess/InternalReportinstallsuccessCommand.cs b/src/Cli/dotnet/commands/dotnet-internal-reportinstallsuccess/InternalReportinstallsuccessCommand.cs
index c032f68b59e6..cdc33a2c1da0 100644
--- a/src/Cli/dotnet/commands/dotnet-internal-reportinstallsuccess/InternalReportinstallsuccessCommand.cs
+++ b/src/Cli/dotnet/commands/dotnet-internal-reportinstallsuccess/InternalReportinstallsuccessCommand.cs
@@ -32,7 +32,7 @@ public static void ProcessInputAndSendTelemetry(string[] args, ITelemetry teleme
public static void ProcessInputAndSendTelemetry(ParseResult result, ITelemetry telemetry)
{
- var exeName = Path.GetFileName(result.GetValueForArgument(InternalReportinstallsuccessCommandParser.Argument));
+ var exeName = Path.GetFileName(result.GetValue(InternalReportinstallsuccessCommandParser.Argument));
var filter = new TelemetryFilter(Sha256Hasher.HashWithNormalizedCasing);
foreach (var e in filter.Filter(new InstallerSuccessReport(exeName)))
diff --git a/src/Cli/dotnet/commands/dotnet-list/dotnet-list-package/ListPackageReferencesCommand.cs b/src/Cli/dotnet/commands/dotnet-list/dotnet-list-package/ListPackageReferencesCommand.cs
index 48b4e33d7993..66db42dcb965 100644
--- a/src/Cli/dotnet/commands/dotnet-list/dotnet-list-package/ListPackageReferencesCommand.cs
+++ b/src/Cli/dotnet/commands/dotnet-list/dotnet-list-package/ListPackageReferencesCommand.cs
@@ -23,7 +23,7 @@ public ListPackageReferencesCommand(
ParseResult parseResult) : base(parseResult)
{
_fileOrDirectory = PathUtility.GetAbsolutePath(PathUtility.EnsureTrailingSlash(Directory.GetCurrentDirectory()),
- parseResult.GetValueForArgument(ListCommandParser.SlnOrProjectArgument));
+ parseResult.GetValue(ListCommandParser.SlnOrProjectArgument));
}
public override int Execute()
diff --git a/src/Cli/dotnet/commands/dotnet-list/dotnet-list-reference/ListProjectToProjectReferencesCommand.cs b/src/Cli/dotnet/commands/dotnet-list/dotnet-list-reference/ListProjectToProjectReferencesCommand.cs
index bc7bc485a93e..0e00d6b33c1e 100644
--- a/src/Cli/dotnet/commands/dotnet-list/dotnet-list-reference/ListProjectToProjectReferencesCommand.cs
+++ b/src/Cli/dotnet/commands/dotnet-list/dotnet-list-reference/ListProjectToProjectReferencesCommand.cs
@@ -20,7 +20,7 @@ public ListProjectToProjectReferencesCommand(
{
ShowHelpOrErrorIfAppropriate(parseResult);
- _fileOrDirectory = parseResult.GetValueForArgument(ListCommandParser.SlnOrProjectArgument);
+ _fileOrDirectory = parseResult.GetValue(ListCommandParser.SlnOrProjectArgument);
}
public override int Execute()
diff --git a/src/Cli/dotnet/commands/dotnet-msbuild/MSBuildCommandParser.cs b/src/Cli/dotnet/commands/dotnet-msbuild/MSBuildCommandParser.cs
index 69ca3c148975..842b7cfc7714 100644
--- a/src/Cli/dotnet/commands/dotnet-msbuild/MSBuildCommandParser.cs
+++ b/src/Cli/dotnet/commands/dotnet-msbuild/MSBuildCommandParser.cs
@@ -29,7 +29,7 @@ private static Command ConstructCommand()
Arguments
};
- command.SetHandler((ParseResult parseResult) => MSBuildCommand.Run(parseResult.GetValueForArgument(Arguments)));
+ command.SetHandler((ParseResult parseResult) => MSBuildCommand.Run(parseResult.GetValue(Arguments)));
return command;
}
diff --git a/src/Cli/dotnet/commands/dotnet-new/NewCommandParser.cs b/src/Cli/dotnet/commands/dotnet-new/NewCommandParser.cs
index e2539675482d..52fb6cd3557a 100644
--- a/src/Cli/dotnet/commands/dotnet-new/NewCommandParser.cs
+++ b/src/Cli/dotnet/commands/dotnet-new/NewCommandParser.cs
@@ -74,12 +74,12 @@ public static Command GetCommand()
static CliTemplateEngineHost GetEngineHost(ParseResult parseResult)
{
- bool disableSdkTemplates = parseResult.GetValueForOption(s_disableSdkTemplatesOption);
- bool disableProjectContext = parseResult.GetValueForOption(s_disableProjectContextEvaluationOption)
+ bool disableSdkTemplates = parseResult.GetValue(s_disableSdkTemplatesOption);
+ bool disableProjectContext = parseResult.GetValue(s_disableProjectContextEvaluationOption)
|| Env.GetEnvironmentVariableAsBool(EnableProjectContextEvaluationEnvVarName);
- bool diagnosticMode = parseResult.GetValueForOption(s_diagnosticOption);
- FileInfo? projectPath = parseResult.GetValueForOption(SharedOptions.ProjectPathOption);
- FileInfo? outputPath = parseResult.GetValueForOption(SharedOptions.OutputOption);
+ bool diagnosticMode = parseResult.GetValue(s_diagnosticOption);
+ FileInfo? projectPath = parseResult.GetValue(SharedOptions.ProjectPathOption);
+ FileInfo? outputPath = parseResult.GetValue(SharedOptions.OutputOption);
OptionResult? verbosityOptionResult = parseResult.FindResultFor(s_verbosityOption);
VerbosityOptions verbosity = DefaultVerbosity;
diff --git a/src/Cli/dotnet/commands/dotnet-nuget/NuGetCommandParser.cs b/src/Cli/dotnet/commands/dotnet-nuget/NuGetCommandParser.cs
index 24f53cfe88aa..44d69c2958a4 100644
--- a/src/Cli/dotnet/commands/dotnet-nuget/NuGetCommandParser.cs
+++ b/src/Cli/dotnet/commands/dotnet-nuget/NuGetCommandParser.cs
@@ -62,7 +62,7 @@ private static Command GetLocalsCommand()
var localsCommand = new Command("locals");
localsCommand.AddArgument(new Argument("folders")
- .FromAmong(new string[] { "all", "http-cache", "global-packages", "plugins-cache", "temp" }));
+ .AcceptOnlyFromAmong(new string[] { "all", "http-cache", "global-packages", "plugins-cache", "temp" }));
localsCommand.AddOption(new Option("--force-english-output"));
localsCommand.AddOption(new Option(new string[] { "-c", "--clear" }));
@@ -119,7 +119,7 @@ private static Command GetTrustCommand()
var trustCommand = new Command("trust");
trustCommand.AddArgument(new Argument("command") { Arity = ArgumentArity.ZeroOrOne }
- .FromAmong(new string[] { "list", "author", "repository", "source", "certificate", "remove", "sync" }));
+ .AcceptOnlyFromAmong(new string[] { "list", "author", "repository", "source", "certificate", "remove", "sync" }));
trustCommand.AddOption(new Option("--algorithm"));
trustCommand.AddOption(new Option("--allow-untrusted-root"));
diff --git a/src/Cli/dotnet/commands/dotnet-pack/PackCommand.cs b/src/Cli/dotnet/commands/dotnet-pack/PackCommand.cs
index 17b205e8bab1..bb51ebb5f4b9 100644
--- a/src/Cli/dotnet/commands/dotnet-pack/PackCommand.cs
+++ b/src/Cli/dotnet/commands/dotnet-pack/PackCommand.cs
@@ -40,7 +40,7 @@ public static PackCommand FromParseResult(ParseResult parseResult, string msbuil
"--property:_IsPacking=true"
};
- IEnumerable slnOrProjectArgs = parseResult.GetValueForArgument(PackCommandParser.SlnOrProjectArgument);
+ IEnumerable slnOrProjectArgs = parseResult.GetValue(PackCommandParser.SlnOrProjectArgument);
msbuildArgs.AddRange(parseResult.OptionValuesToBeForwarded(PackCommandParser.GetCommand()));
ReleasePropertyProjectLocator projectLocator = new ReleasePropertyProjectLocator(Environment.GetEnvironmentVariable(EnvironmentVariableNames.ENABLE_PACK_RELEASE_FOR_SOLUTIONS) != null);
diff --git a/src/Cli/dotnet/commands/dotnet-publish/Program.cs b/src/Cli/dotnet/commands/dotnet-publish/Program.cs
index 4ddfabd66e24..5be412ac121b 100644
--- a/src/Cli/dotnet/commands/dotnet-publish/Program.cs
+++ b/src/Cli/dotnet/commands/dotnet-publish/Program.cs
@@ -49,7 +49,7 @@ public static PublishCommand FromParseResult(ParseResult parseResult, string msb
"--property:_IsPublishing=true" // This property will not hold true for MSBuild /t:Publish. VS should also inject this property when publishing in the future.
};
- IEnumerable slnOrProjectArgs = parseResult.GetValueForArgument(PublishCommandParser.SlnOrProjectArgument);
+ IEnumerable slnOrProjectArgs = parseResult.GetValue(PublishCommandParser.SlnOrProjectArgument);
CommonOptions.ValidateSelfContainedOptions(parseResult.HasOption(PublishCommandParser.SelfContainedOption),
parseResult.HasOption(PublishCommandParser.NoSelfContainedOption));
diff --git a/src/Cli/dotnet/commands/dotnet-remove/dotnet-remove-package/Program.cs b/src/Cli/dotnet/commands/dotnet-remove/dotnet-remove-package/Program.cs
index ecd066b98838..08c23e53e16a 100644
--- a/src/Cli/dotnet/commands/dotnet-remove/dotnet-remove-package/Program.cs
+++ b/src/Cli/dotnet/commands/dotnet-remove/dotnet-remove-package/Program.cs
@@ -21,8 +21,8 @@ internal class RemovePackageReferenceCommand : CommandBase
public RemovePackageReferenceCommand(
ParseResult parseResult) : base(parseResult)
{
- _fileOrDirectory = parseResult.GetValueForArgument(RemoveCommandParser.ProjectArgument);
- _arguments = parseResult.GetValueForArgument(RemovePackageParser.CmdPackageArgument).ToList().AsReadOnly();
+ _fileOrDirectory = parseResult.GetValue(RemoveCommandParser.ProjectArgument);
+ _arguments = parseResult.GetValue(RemovePackageParser.CmdPackageArgument).ToList().AsReadOnly();
if (_fileOrDirectory == null)
{
throw new ArgumentNullException(nameof(_fileOrDirectory));
diff --git a/src/Cli/dotnet/commands/dotnet-remove/dotnet-remove-reference/Program.cs b/src/Cli/dotnet/commands/dotnet-remove/dotnet-remove-reference/Program.cs
index 440e6863a885..8dd0043ebb56 100644
--- a/src/Cli/dotnet/commands/dotnet-remove/dotnet-remove-reference/Program.cs
+++ b/src/Cli/dotnet/commands/dotnet-remove/dotnet-remove-reference/Program.cs
@@ -20,8 +20,8 @@ internal class RemoveProjectToProjectReferenceCommand : CommandBase
public RemoveProjectToProjectReferenceCommand(
ParseResult parseResult) : base(parseResult)
{
- _fileOrDirectory = parseResult.GetValueForArgument(RemoveCommandParser.ProjectArgument);
- _arguments = parseResult.GetValueForArgument(RemoveProjectToProjectReferenceParser.ProjectPathArgument).ToList().AsReadOnly();
+ _fileOrDirectory = parseResult.GetValue(RemoveCommandParser.ProjectArgument);
+ _arguments = parseResult.GetValue(RemoveProjectToProjectReferenceParser.ProjectPathArgument).ToList().AsReadOnly();
if (_arguments.Count == 0)
{
@@ -46,7 +46,7 @@ public override int Execute()
});
int numberOfRemovedReferences = msbuildProj.RemoveProjectToProjectReferences(
- _parseResult.GetValueForOption(RemoveProjectToProjectReferenceParser.FrameworkOption),
+ _parseResult.GetValue(RemoveProjectToProjectReferenceParser.FrameworkOption),
references);
if (numberOfRemovedReferences != 0)
diff --git a/src/Cli/dotnet/commands/dotnet-restore/Program.cs b/src/Cli/dotnet/commands/dotnet-restore/Program.cs
index f6c0be7686c4..a6a412513563 100644
--- a/src/Cli/dotnet/commands/dotnet-restore/Program.cs
+++ b/src/Cli/dotnet/commands/dotnet-restore/Program.cs
@@ -43,7 +43,7 @@ public static RestoreCommand FromParseResult(ParseResult result, string msbuildP
msbuildArgs.AddRange(result.OptionValuesToBeForwarded(RestoreCommandParser.GetCommand()));
- msbuildArgs.AddRange(result.GetValueForArgument(RestoreCommandParser.SlnOrProjectArgument) ?? Array.Empty());
+ msbuildArgs.AddRange(result.GetValue(RestoreCommandParser.SlnOrProjectArgument) ?? Array.Empty());
return new RestoreCommand(msbuildArgs, msbuildPath);
}
diff --git a/src/Cli/dotnet/commands/dotnet-run/Program.cs b/src/Cli/dotnet/commands/dotnet-run/Program.cs
index 4aedeb5aeeb0..797e7cdc99d8 100644
--- a/src/Cli/dotnet/commands/dotnet-run/Program.cs
+++ b/src/Cli/dotnet/commands/dotnet-run/Program.cs
@@ -21,7 +21,7 @@ public static RunCommand FromArgs(string[] args)
public static RunCommand FromParseResult(ParseResult parseResult)
{
- var project = parseResult.GetValueForOption(RunCommandParser.ProjectOption);
+ var project = parseResult.GetValue(RunCommandParser.ProjectOption);
if (parseResult.UsingRunCommandShorthandProjectOption())
{
Reporter.Output.WriteLine(LocalizableStrings.RunCommandProjectAbbreviationDeprecated.Yellow());
@@ -29,17 +29,17 @@ public static RunCommand FromParseResult(ParseResult parseResult)
}
var command = new RunCommand(
- configuration: parseResult.GetValueForOption(RunCommandParser.ConfigurationOption),
- framework: parseResult.GetValueForOption(RunCommandParser.FrameworkOption),
+ configuration: parseResult.GetValue(RunCommandParser.ConfigurationOption),
+ framework: parseResult.GetValue(RunCommandParser.FrameworkOption),
runtime: parseResult.GetCommandLineRuntimeIdentifier(),
noBuild: parseResult.HasOption(RunCommandParser.NoBuildOption),
project: project,
- launchProfile: parseResult.GetValueForOption(RunCommandParser.LaunchProfileOption),
+ launchProfile: parseResult.GetValue(RunCommandParser.LaunchProfileOption),
noLaunchProfile: parseResult.HasOption(RunCommandParser.NoLaunchProfileOption),
noRestore: parseResult.HasOption(RunCommandParser.NoRestoreOption) || parseResult.HasOption(RunCommandParser.NoBuildOption),
interactive: parseResult.HasOption(RunCommandParser.InteractiveOption),
restoreArgs: parseResult.OptionValuesToBeForwarded(RunCommandParser.GetCommand()),
- args: parseResult.GetValueForArgument(RunCommandParser.ApplicationArguments)
+ args: parseResult.GetValue(RunCommandParser.ApplicationArguments)
);
return command;
diff --git a/src/Cli/dotnet/commands/dotnet-sln/add/Program.cs b/src/Cli/dotnet/commands/dotnet-sln/add/Program.cs
index 52e453e44e3c..cc2ab660e2e2 100644
--- a/src/Cli/dotnet/commands/dotnet-sln/add/Program.cs
+++ b/src/Cli/dotnet/commands/dotnet-sln/add/Program.cs
@@ -23,10 +23,10 @@ internal class AddProjectToSolutionCommand : CommandBase
public AddProjectToSolutionCommand(
ParseResult parseResult) : base(parseResult)
{
- _fileOrDirectory = parseResult.GetValueForArgument(SlnCommandParser.SlnArgument);
+ _fileOrDirectory = parseResult.GetValue(SlnCommandParser.SlnArgument);
- _inRoot = parseResult.GetValueForOption(SlnAddParser.InRootOption);
- string relativeRoot = parseResult.GetValueForOption(SlnAddParser.SolutionFolderOption);
+ _inRoot = parseResult.GetValue(SlnAddParser.InRootOption);
+ string relativeRoot = parseResult.GetValue(SlnAddParser.SolutionFolderOption);
bool hasRelativeRoot = !string.IsNullOrEmpty(relativeRoot);
if (_inRoot && hasRelativeRoot)
@@ -50,7 +50,7 @@ public override int Execute()
{
SlnFile slnFile = SlnFileFactory.CreateFromFileOrDirectory(_fileOrDirectory);
- var arguments = (_parseResult.GetValueForArgument>(SlnAddParser.ProjectPathArgument) ?? Array.Empty()).ToList().AsReadOnly();
+ var arguments = (_parseResult.GetValue>(SlnAddParser.ProjectPathArgument) ?? Array.Empty()).ToList().AsReadOnly();
if (arguments.Count == 0)
{
throw new GracefulException(CommonLocalizableStrings.SpecifyAtLeastOneProjectToAdd);
diff --git a/src/Cli/dotnet/commands/dotnet-sln/list/Program.cs b/src/Cli/dotnet/commands/dotnet-sln/list/Program.cs
index fa65e0d3b55a..86407b6e9971 100644
--- a/src/Cli/dotnet/commands/dotnet-sln/list/Program.cs
+++ b/src/Cli/dotnet/commands/dotnet-sln/list/Program.cs
@@ -19,7 +19,7 @@ internal class ListProjectsInSolutionCommand : CommandBase
public ListProjectsInSolutionCommand(
ParseResult parseResult) : base(parseResult)
{
- _fileOrDirectory = parseResult.GetValueForArgument(SlnCommandParser.SlnArgument);
+ _fileOrDirectory = parseResult.GetValue(SlnCommandParser.SlnArgument);
}
public override int Execute()
diff --git a/src/Cli/dotnet/commands/dotnet-sln/remove/Program.cs b/src/Cli/dotnet/commands/dotnet-sln/remove/Program.cs
index a36bfe066cbe..6d530c8875c9 100644
--- a/src/Cli/dotnet/commands/dotnet-sln/remove/Program.cs
+++ b/src/Cli/dotnet/commands/dotnet-sln/remove/Program.cs
@@ -22,13 +22,13 @@ internal class RemoveProjectFromSolutionCommand : CommandBase
public RemoveProjectFromSolutionCommand(
ParseResult parseResult) : base(parseResult)
{
- _arguments = (parseResult.GetValueForArgument(SlnRemoveParser.ProjectPathArgument) ?? Array.Empty()).ToList().AsReadOnly();
+ _arguments = (parseResult.GetValue(SlnRemoveParser.ProjectPathArgument) ?? Array.Empty()).ToList().AsReadOnly();
if (_arguments.Count == 0)
{
throw new GracefulException(CommonLocalizableStrings.SpecifyAtLeastOneProjectToRemove);
}
- _fileOrDirectory = parseResult.GetValueForArgument(SlnCommandParser.SlnArgument);
+ _fileOrDirectory = parseResult.GetValue(SlnCommandParser.SlnArgument);
}
public override int Execute()
diff --git a/src/Cli/dotnet/commands/dotnet-store/Program.cs b/src/Cli/dotnet/commands/dotnet-store/Program.cs
index a8bb62da4764..8afd8b7d150a 100644
--- a/src/Cli/dotnet/commands/dotnet-store/Program.cs
+++ b/src/Cli/dotnet/commands/dotnet-store/Program.cs
@@ -41,7 +41,7 @@ public static StoreCommand FromParseResult(ParseResult result, string msbuildPat
msbuildArgs.AddRange(result.OptionValuesToBeForwarded(StoreCommandParser.GetCommand()));
- msbuildArgs.AddRange(result.GetValueForArgument(StoreCommandParser.Argument) ?? Array.Empty());
+ msbuildArgs.AddRange(result.GetValue(StoreCommandParser.Argument) ?? Array.Empty());
return new StoreCommand(msbuildArgs, msbuildPath);
}
diff --git a/src/Cli/dotnet/commands/dotnet-test/Program.cs b/src/Cli/dotnet/commands/dotnet-test/Program.cs
index 907293b5732c..6396cf246302 100644
--- a/src/Cli/dotnet/commands/dotnet-test/Program.cs
+++ b/src/Cli/dotnet/commands/dotnet-test/Program.cs
@@ -123,10 +123,10 @@ private static TestCommand FromParseResult(ParseResult result, string[] settings
if (settings.Any())
{
//workaround for correct -- logic
- var commandArgument = result.GetValueForArgument(TestCommandParser.SlnOrProjectArgument);
+ var commandArgument = result.GetValue(TestCommandParser.SlnOrProjectArgument);
if(!string.IsNullOrWhiteSpace(commandArgument) && !settings.Contains(commandArgument))
{
- msbuildArgs.Add(result.GetValueForArgument(TestCommandParser.SlnOrProjectArgument));
+ msbuildArgs.Add(result.GetValue(TestCommandParser.SlnOrProjectArgument));
}
// skip '--' and escape every \ to be \\ and every " to be \" to survive the next hop
@@ -137,7 +137,7 @@ private static TestCommand FromParseResult(ParseResult result, string[] settings
}
else
{
- var argument = result.GetValueForArgument(TestCommandParser.SlnOrProjectArgument);
+ var argument = result.GetValue(TestCommandParser.SlnOrProjectArgument);
if(!string.IsNullOrWhiteSpace(argument))
msbuildArgs.Add(argument);
}
@@ -203,7 +203,7 @@ internal static int RunArtifactPostProcessingIfNeeded(string testSessionCorrelat
if (parseResult.HasOption(TestCommandParser.DiagOption))
{
- artifactsPostProcessArgs.Add($"--diag:{parseResult.GetValueForOption(TestCommandParser.DiagOption)}");
+ artifactsPostProcessArgs.Add($"--diag:{parseResult.GetValue(TestCommandParser.DiagOption)}");
}
try
@@ -229,7 +229,7 @@ internal static int RunArtifactPostProcessingIfNeeded(string testSessionCorrelat
private static bool ContainsBuiltTestSources(ParseResult parseResult)
{
- string commandArgument = parseResult.GetValueForArgument(TestCommandParser.SlnOrProjectArgument);
+ string commandArgument = parseResult.GetValue(TestCommandParser.SlnOrProjectArgument);
if (commandArgument is not null && (commandArgument.EndsWith(".dll", StringComparison.OrdinalIgnoreCase) || commandArgument.EndsWith(".exe", StringComparison.OrdinalIgnoreCase)))
{
@@ -248,7 +248,7 @@ private static void SetEnvironmentVariablesFromParameters(TestCommand testComman
return;
}
- foreach (string env in parseResult.GetValueForOption(option))
+ foreach (string env in parseResult.GetValue(option))
{
string name = env;
string value = string.Empty;
diff --git a/src/Cli/dotnet/commands/dotnet-test/TestCommandParser.cs b/src/Cli/dotnet/commands/dotnet-test/TestCommandParser.cs
index 01dae98187d0..ed2f062604c3 100644
--- a/src/Cli/dotnet/commands/dotnet-test/TestCommandParser.cs
+++ b/src/Cli/dotnet/commands/dotnet-test/TestCommandParser.cs
@@ -93,8 +93,8 @@ internal static class TestCommandParser
{
ArgumentHelpName = LocalizableStrings.CrashDumpTypeArgumentName,
}
- .FromAmong(new string[] { "full", "mini" })
- .ForwardAsMany(o => new[] { "-property:VSTestBlameCrash=true", $"-property:VSTestBlameCrashDumpType={o}" });
+ .ForwardAsMany(o => new[] { "-property:VSTestBlameCrash=true", $"-property:VSTestBlameCrashDumpType={o}" })
+ .AcceptOnlyFromAmong(new string[] { "full", "mini" });
public static readonly Option BlameCrashAlwaysOption = new ForwardedOption("--blame-crash-collect-always", LocalizableStrings.CmdBlameCrashCollectAlwaysDescription)
.ForwardAsMany(o => new[] { "-property:VSTestBlameCrash=true", "-property:VSTestBlameCrashCollectAlways=true" });
@@ -106,8 +106,8 @@ internal static class TestCommandParser
{
ArgumentHelpName = LocalizableStrings.HangDumpTypeArgumentName
}
- .FromAmong(new string[] { "full", "mini", "none" })
- .ForwardAsMany(o => new[] { "-property:VSTestBlameHang=true", $"-property:VSTestBlameHangDumpType={o}" });
+ .ForwardAsMany(o => new[] { "-property:VSTestBlameHang=true", $"-property:VSTestBlameHangDumpType={o}" })
+ .AcceptOnlyFromAmong(new string[] { "full", "mini", "none" });
public static readonly Option BlameHangTimeoutOption = new ForwardedOption("--blame-hang-timeout", LocalizableStrings.CmdBlameHangTimeoutDescription)
{
diff --git a/src/Cli/dotnet/commands/dotnet-tool/common/ToolAppliedOption.cs b/src/Cli/dotnet/commands/dotnet-tool/common/ToolAppliedOption.cs
index 15677fcaf7e4..1426fc26c6b4 100644
--- a/src/Cli/dotnet/commands/dotnet-tool/common/ToolAppliedOption.cs
+++ b/src/Cli/dotnet/commands/dotnet-tool/common/ToolAppliedOption.cs
@@ -41,7 +41,7 @@ internal static void EnsureNoConflictGlobalLocalToolPathOption(
options.Add(LocalOption.Name);
}
- if (!String.IsNullOrWhiteSpace(parseResult.GetValueForOption(ToolPathOption)))
+ if (!String.IsNullOrWhiteSpace(parseResult.GetValue(ToolPathOption)))
{
options.Add(ToolPathOption.Name);
}
@@ -59,7 +59,7 @@ internal static void EnsureNoConflictGlobalLocalToolPathOption(
internal static void EnsureToolManifestAndOnlyLocalFlagCombination(ParseResult parseResult)
{
if (GlobalOrToolPath(parseResult) &&
- !string.IsNullOrWhiteSpace(parseResult.GetValueForOption(ToolManifestOption)))
+ !string.IsNullOrWhiteSpace(parseResult.GetValue(ToolManifestOption)))
{
throw new GracefulException(
string.Format(
@@ -70,7 +70,7 @@ internal static void EnsureToolManifestAndOnlyLocalFlagCombination(ParseResult p
private static bool GlobalOrToolPath(ParseResult parseResult)
{
return parseResult.HasOption(GlobalOption) ||
- !string.IsNullOrWhiteSpace(parseResult.GetValueForOption(ToolPathOption));
+ !string.IsNullOrWhiteSpace(parseResult.GetValue(ToolPathOption));
}
}
}
diff --git a/src/Cli/dotnet/commands/dotnet-tool/install/ParseResultExtension.cs b/src/Cli/dotnet/commands/dotnet-tool/install/ParseResultExtension.cs
index 77a804f6d8d5..830bfe39341c 100644
--- a/src/Cli/dotnet/commands/dotnet-tool/install/ParseResultExtension.cs
+++ b/src/Cli/dotnet/commands/dotnet-tool/install/ParseResultExtension.cs
@@ -13,8 +13,8 @@ internal static class ParseResultExtension
{
public static VersionRange GetVersionRange(this ParseResult parseResult)
{
- string packageVersion = parseResult.GetValueForOption(ToolInstallCommandParser.VersionOption);
- bool prerelease = parseResult.GetValueForOption(ToolInstallCommandParser.PrereleaseOption);
+ string packageVersion = parseResult.GetValue(ToolInstallCommandParser.VersionOption);
+ bool prerelease = parseResult.GetValue(ToolInstallCommandParser.PrereleaseOption);
if (!string.IsNullOrEmpty(packageVersion) && prerelease)
{
diff --git a/src/Cli/dotnet/commands/dotnet-tool/install/ToolInstallCommand.cs b/src/Cli/dotnet/commands/dotnet-tool/install/ToolInstallCommand.cs
index 81b9779599b9..76e3ce079cfe 100644
--- a/src/Cli/dotnet/commands/dotnet-tool/install/ToolInstallCommand.cs
+++ b/src/Cli/dotnet/commands/dotnet-tool/install/ToolInstallCommand.cs
@@ -33,10 +33,10 @@ public ToolInstallCommand(
toolInstallGlobalOrToolPathCommand
?? new ToolInstallGlobalOrToolPathCommand(_parseResult);
- _global = parseResult.GetValueForOption(ToolAppliedOption.GlobalOption);
- _local = parseResult.GetValueForOption(ToolAppliedOption.LocalOption);
- _toolPath = parseResult.GetValueForOption(ToolAppliedOption.ToolPathOption);
- _framework = parseResult.GetValueForOption(ToolInstallCommandParser.FrameworkOption);
+ _global = parseResult.GetValue(ToolAppliedOption.GlobalOption);
+ _local = parseResult.GetValue(ToolAppliedOption.LocalOption);
+ _toolPath = parseResult.GetValue(ToolAppliedOption.ToolPathOption);
+ _framework = parseResult.GetValue(ToolInstallCommandParser.FrameworkOption);
}
public override int Execute()
diff --git a/src/Cli/dotnet/commands/dotnet-tool/install/ToolInstallGlobalOrToolPathCommand.cs b/src/Cli/dotnet/commands/dotnet-tool/install/ToolInstallGlobalOrToolPathCommand.cs
index 0b4c199f1b3e..502141f2ce96 100644
--- a/src/Cli/dotnet/commands/dotnet-tool/install/ToolInstallGlobalOrToolPathCommand.cs
+++ b/src/Cli/dotnet/commands/dotnet-tool/install/ToolInstallGlobalOrToolPathCommand.cs
@@ -55,15 +55,15 @@ public ToolInstallGlobalOrToolPathCommand(
INuGetPackageDownloader nugetPackageDownloader = null)
: base(parseResult)
{
- _packageId = new PackageId(parseResult.GetValueForArgument(ToolInstallCommandParser.PackageIdArgument));
- _packageVersion = parseResult.GetValueForOption(ToolInstallCommandParser.VersionOption);
- _configFilePath = parseResult.GetValueForOption(ToolInstallCommandParser.ConfigOption);
- _framework = parseResult.GetValueForOption(ToolInstallCommandParser.FrameworkOption);
- _source = parseResult.GetValueForOption(ToolInstallCommandParser.AddSourceOption);
- _global = parseResult.GetValueForOption(ToolAppliedOption.GlobalOption);
- _verbosity = Enum.GetName(parseResult.GetValueForOption(ToolInstallCommandParser.VerbosityOption));
- _toolPath = parseResult.GetValueForOption(ToolAppliedOption.ToolPathOption);
- _architectureOption = parseResult.GetValueForOption(ToolInstallCommandParser.ArchitectureOption);
+ _packageId = new PackageId(parseResult.GetValue(ToolInstallCommandParser.PackageIdArgument));
+ _packageVersion = parseResult.GetValue(ToolInstallCommandParser.VersionOption);
+ _configFilePath = parseResult.GetValue(ToolInstallCommandParser.ConfigOption);
+ _framework = parseResult.GetValue(ToolInstallCommandParser.FrameworkOption);
+ _source = parseResult.GetValue(ToolInstallCommandParser.AddSourceOption);
+ _global = parseResult.GetValue(ToolAppliedOption.GlobalOption);
+ _verbosity = Enum.GetName(parseResult.GetValue(ToolInstallCommandParser.VerbosityOption));
+ _toolPath = parseResult.GetValue(ToolAppliedOption.ToolPathOption);
+ _architectureOption = parseResult.GetValue(ToolInstallCommandParser.ArchitectureOption);
_createToolPackageStoresAndInstaller = createToolPackageStoreAndInstaller ?? ToolPackageFactory.CreateToolPackageStoresAndInstaller;
_forwardRestoreArguments = parseResult.OptionValuesToBeForwarded(ToolInstallCommandParser.GetCommand());
@@ -72,13 +72,13 @@ public ToolInstallGlobalOrToolPathCommand(
?? EnvironmentPathFactory.CreateEnvironmentPathInstruction();
_createShellShimRepository = createShellShimRepository ?? ShellShimRepositoryFactory.CreateShellShimRepository;
var tempDir = new DirectoryPath(PathUtilities.CreateTempSubdirectory());
- var configOption = parseResult.GetValueForOption(ToolInstallCommandParser.ConfigOption);
- var sourceOption = parseResult.GetValueForOption(ToolInstallCommandParser.AddSourceOption);
+ var configOption = parseResult.GetValue(ToolInstallCommandParser.ConfigOption);
+ var sourceOption = parseResult.GetValue(ToolInstallCommandParser.AddSourceOption);
var packageSourceLocation = new PackageSourceLocation(string.IsNullOrEmpty(configOption) ? null : new FilePath(configOption), additionalSourceFeeds: sourceOption);
- var restoreAction = new RestoreActionConfig(DisableParallel: parseResult.GetValueForOption(ToolCommandRestorePassThroughOptions.DisableParallelOption),
- NoCache: parseResult.GetValueForOption(ToolCommandRestorePassThroughOptions.NoCacheOption),
- IgnoreFailedSources: parseResult.GetValueForOption(ToolCommandRestorePassThroughOptions.IgnoreFailedSourcesOption),
- Interactive: parseResult.GetValueForOption(ToolCommandRestorePassThroughOptions.InteractiveRestoreOption));
+ var restoreAction = new RestoreActionConfig(DisableParallel: parseResult.GetValue(ToolCommandRestorePassThroughOptions.DisableParallelOption),
+ NoCache: parseResult.GetValue(ToolCommandRestorePassThroughOptions.NoCacheOption),
+ IgnoreFailedSources: parseResult.GetValue(ToolCommandRestorePassThroughOptions.IgnoreFailedSourcesOption),
+ Interactive: parseResult.GetValue(ToolCommandRestorePassThroughOptions.InteractiveRestoreOption));
nugetPackageDownloader ??= new NuGetPackageDownloader(tempDir, verboseLogger: new NullLogger(), restoreActionConfig: restoreAction);
_shellShimTemplateFinder = new ShellShimTemplateFinder(nugetPackageDownloader, tempDir, packageSourceLocation);
diff --git a/src/Cli/dotnet/commands/dotnet-tool/install/ToolInstallLocalCommand.cs b/src/Cli/dotnet/commands/dotnet-tool/install/ToolInstallLocalCommand.cs
index 690f1abe00da..d7ce6283cda9 100644
--- a/src/Cli/dotnet/commands/dotnet-tool/install/ToolInstallLocalCommand.cs
+++ b/src/Cli/dotnet/commands/dotnet-tool/install/ToolInstallLocalCommand.cs
@@ -33,7 +33,7 @@ public ToolInstallLocalCommand(
IReporter reporter = null)
: base(parseResult)
{
- _explicitManifestFile = parseResult.GetValueForOption(ToolAppliedOption.ToolManifestOption);
+ _explicitManifestFile = parseResult.GetValue(ToolAppliedOption.ToolManifestOption);
_reporter = (reporter ?? Reporter.Output);
diff --git a/src/Cli/dotnet/commands/dotnet-tool/install/ToolInstallLocalInstaller.cs b/src/Cli/dotnet/commands/dotnet-tool/install/ToolInstallLocalInstaller.cs
index 3935d09a6044..8af14a830c8a 100644
--- a/src/Cli/dotnet/commands/dotnet-tool/install/ToolInstallLocalInstaller.cs
+++ b/src/Cli/dotnet/commands/dotnet-tool/install/ToolInstallLocalInstaller.cs
@@ -30,11 +30,11 @@ public ToolInstallLocalInstaller(
IToolPackageInstaller toolPackageInstaller = null)
{
_parseResult = parseResult;
- _packageId = new PackageId(parseResult.GetValueForArgument(ToolInstallCommandParser.PackageIdArgument));
- _packageVersion = parseResult.GetValueForOption(ToolInstallCommandParser.VersionOption);
- _configFilePath = parseResult.GetValueForOption(ToolInstallCommandParser.ConfigOption);
- _sources = parseResult.GetValueForOption(ToolInstallCommandParser.AddSourceOption);
- _verbosity = Enum.GetName(parseResult.GetValueForOption(ToolInstallCommandParser.VerbosityOption));
+ _packageId = new PackageId(parseResult.GetValue(ToolInstallCommandParser.PackageIdArgument));
+ _packageVersion = parseResult.GetValue(ToolInstallCommandParser.VersionOption);
+ _configFilePath = parseResult.GetValue(ToolInstallCommandParser.ConfigOption);
+ _sources = parseResult.GetValue(ToolInstallCommandParser.AddSourceOption);
+ _verbosity = Enum.GetName(parseResult.GetValue(ToolInstallCommandParser.VerbosityOption));
if (toolPackageInstaller == null)
{
diff --git a/src/Cli/dotnet/commands/dotnet-tool/list/ToolListCommand.cs b/src/Cli/dotnet/commands/dotnet-tool/list/ToolListCommand.cs
index 652fe7e18a3e..7f517b0a70ca 100644
--- a/src/Cli/dotnet/commands/dotnet-tool/list/ToolListCommand.cs
+++ b/src/Cli/dotnet/commands/dotnet-tool/list/ToolListCommand.cs
@@ -32,7 +32,7 @@ public override int Execute()
_parseResult,
LocalizableStrings.ListToolCommandInvalidGlobalAndLocalAndToolPath);
- if (_parseResult.GetValueForOption(ToolListCommandParser.GlobalOption)
+ if (_parseResult.GetValue(ToolListCommandParser.GlobalOption)
|| _parseResult.HasOption(ToolListCommandParser.ToolPathOption))
{
return _toolListGlobalOrToolPathCommand.Execute();
diff --git a/src/Cli/dotnet/commands/dotnet-tool/list/ToolListGlobalOrToolPathCommand.cs b/src/Cli/dotnet/commands/dotnet-tool/list/ToolListGlobalOrToolPathCommand.cs
index 89c2098f58f2..19b30383e663 100644
--- a/src/Cli/dotnet/commands/dotnet-tool/list/ToolListGlobalOrToolPathCommand.cs
+++ b/src/Cli/dotnet/commands/dotnet-tool/list/ToolListGlobalOrToolPathCommand.cs
@@ -36,8 +36,8 @@ public ToolListGlobalOrToolPathCommand(
public override int Execute()
{
- var toolPathOption = _parseResult.GetValueForOption(ToolListCommandParser.ToolPathOption);
- var packageIdArgument = _parseResult.GetValueForArgument(ToolListCommandParser.PackageIdArgument);
+ var toolPathOption = _parseResult.GetValue(ToolListCommandParser.ToolPathOption);
+ var packageIdArgument = _parseResult.GetValue(ToolListCommandParser.PackageIdArgument);
PackageId? packageId = null;
if (!string.IsNullOrWhiteSpace(packageIdArgument))
diff --git a/src/Cli/dotnet/commands/dotnet-tool/list/ToolListLocalCommand.cs b/src/Cli/dotnet/commands/dotnet-tool/list/ToolListLocalCommand.cs
index 05c79b7d2064..f71ea0bdeb9a 100644
--- a/src/Cli/dotnet/commands/dotnet-tool/list/ToolListLocalCommand.cs
+++ b/src/Cli/dotnet/commands/dotnet-tool/list/ToolListLocalCommand.cs
@@ -34,7 +34,7 @@ public ToolListLocalCommand(
public override int Execute()
{
var table = new PrintableTable<(ToolManifestPackage toolManifestPackage, FilePath SourceManifest)>();
- var packageIdArgument = _parseResult.GetValueForArgument(ToolListCommandParser.PackageIdArgument);
+ var packageIdArgument = _parseResult.GetValue(ToolListCommandParser.PackageIdArgument);
PackageId? packageId = null;
if (!string.IsNullOrWhiteSpace(packageIdArgument))
{
diff --git a/src/Cli/dotnet/commands/dotnet-tool/restore/ToolRestoreCommand.cs b/src/Cli/dotnet/commands/dotnet-tool/restore/ToolRestoreCommand.cs
index 3cfa69aaaf35..4ed9209933d2 100644
--- a/src/Cli/dotnet/commands/dotnet-tool/restore/ToolRestoreCommand.cs
+++ b/src/Cli/dotnet/commands/dotnet-tool/restore/ToolRestoreCommand.cs
@@ -62,9 +62,9 @@ public ToolRestoreCommand(
_reporter = reporter ?? Reporter.Output;
_errorReporter = reporter ?? Reporter.Error;
- _configFilePath = result.GetValueForOption(ToolRestoreCommandParser.ConfigOption);
- _sources = result.GetValueForOption(ToolRestoreCommandParser.AddSourceOption);
- _verbosity = Enum.GetName(result.GetValueForOption(ToolRestoreCommandParser.VerbosityOption));
+ _configFilePath = result.GetValue(ToolRestoreCommandParser.ConfigOption);
+ _sources = result.GetValue(ToolRestoreCommandParser.AddSourceOption);
+ _verbosity = Enum.GetName(result.GetValue(ToolRestoreCommandParser.VerbosityOption));
}
public override int Execute()
@@ -245,7 +245,7 @@ private bool PackageHasBeenRestored(
private FilePath? GetCustomManifestFileLocation()
{
- string customFile = _parseResult.GetValueForOption(ToolRestoreCommandParser.ToolManifestOption);
+ string customFile = _parseResult.GetValue(ToolRestoreCommandParser.ToolManifestOption);
FilePath? customManifestFileLocation;
if (!string.IsNullOrEmpty(customFile))
{
diff --git a/src/Cli/dotnet/commands/dotnet-tool/run/ToolRunCommand.cs b/src/Cli/dotnet/commands/dotnet-tool/run/ToolRunCommand.cs
index 111d0df12b83..4cc686365c9b 100644
--- a/src/Cli/dotnet/commands/dotnet-tool/run/ToolRunCommand.cs
+++ b/src/Cli/dotnet/commands/dotnet-tool/run/ToolRunCommand.cs
@@ -22,8 +22,8 @@ public ToolRunCommand(
LocalToolsCommandResolver localToolsCommandResolver = null)
: base(result)
{
- _toolCommandName = result.GetValueForArgument(ToolRunCommandParser.CommandNameArgument);
- _forwardArgument = result.GetValueForArgument(ToolRunCommandParser.CommandArgument);
+ _toolCommandName = result.GetValue(ToolRunCommandParser.CommandNameArgument);
+ _forwardArgument = result.GetValue(ToolRunCommandParser.CommandArgument);
_localToolsCommandResolver = localToolsCommandResolver ?? new LocalToolsCommandResolver();
}
diff --git a/src/Cli/dotnet/commands/dotnet-tool/search/ToolSearchCommand.cs b/src/Cli/dotnet/commands/dotnet-tool/search/ToolSearchCommand.cs
index 61b0899e4df4..01672c7bae4f 100644
--- a/src/Cli/dotnet/commands/dotnet-tool/search/ToolSearchCommand.cs
+++ b/src/Cli/dotnet/commands/dotnet-tool/search/ToolSearchCommand.cs
@@ -27,7 +27,7 @@ public ToolSearchCommand(
public override int Execute()
{
- var isDetailed = _parseResult.GetValueForOption(ToolSearchCommandParser.DetailOption);
+ var isDetailed = _parseResult.GetValue(ToolSearchCommandParser.DetailOption);
NugetSearchApiParameter nugetSearchApiParameter = new NugetSearchApiParameter(_parseResult);
IReadOnlyCollection searchResultPackages =
NugetSearchApiResultDeserializer.Deserialize(
diff --git a/src/Cli/dotnet/commands/dotnet-tool/uninstall/ToolUninstallCommand.cs b/src/Cli/dotnet/commands/dotnet-tool/uninstall/ToolUninstallCommand.cs
index bc46696c607c..8d19de2215ad 100644
--- a/src/Cli/dotnet/commands/dotnet-tool/uninstall/ToolUninstallCommand.cs
+++ b/src/Cli/dotnet/commands/dotnet-tool/uninstall/ToolUninstallCommand.cs
@@ -31,8 +31,8 @@ public ToolUninstallCommand(
toolUninstallGlobalOrToolPathCommand
?? new ToolUninstallGlobalOrToolPathCommand(result);
- _global = result.GetValueForOption(ToolUninstallCommandParser.GlobalOption);
- _toolPath = result.GetValueForOption(ToolUninstallCommandParser.ToolPathOption);
+ _global = result.GetValue(ToolUninstallCommandParser.GlobalOption);
+ _toolPath = result.GetValue(ToolUninstallCommandParser.ToolPathOption);
}
public override int Execute()
diff --git a/src/Cli/dotnet/commands/dotnet-tool/uninstall/ToolUninstallGlobalOrToolPathCommand.cs b/src/Cli/dotnet/commands/dotnet-tool/uninstall/ToolUninstallGlobalOrToolPathCommand.cs
index 18003c1acb8c..b2f1de903589 100644
--- a/src/Cli/dotnet/commands/dotnet-tool/uninstall/ToolUninstallGlobalOrToolPathCommand.cs
+++ b/src/Cli/dotnet/commands/dotnet-tool/uninstall/ToolUninstallGlobalOrToolPathCommand.cs
@@ -42,8 +42,8 @@ public ToolUninstallGlobalOrToolPathCommand(
public override int Execute()
{
- var global = _parseResult.GetValueForOption(ToolAppliedOption.GlobalOption);
- var toolPath = _parseResult.GetValueForOption(ToolAppliedOption.ToolPathOption);
+ var global = _parseResult.GetValue(ToolAppliedOption.GlobalOption);
+ var toolPath = _parseResult.GetValue(ToolAppliedOption.ToolPathOption);
DirectoryPath? toolDirectoryPath = null;
if (!string.IsNullOrWhiteSpace(toolPath))
@@ -64,7 +64,7 @@ public override int Execute()
var appHostSourceDirectory = ShellShimTemplateFinder.GetDefaultAppHostSourceDirectory();
IShellShimRepository shellShimRepository = _createShellShimRepository(appHostSourceDirectory, toolDirectoryPath);
- var packageId = new PackageId(_parseResult.GetValueForArgument(ToolInstallCommandParser.PackageIdArgument));
+ var packageId = new PackageId(_parseResult.GetValue(ToolInstallCommandParser.PackageIdArgument));
IToolPackage package = null;
try
{
diff --git a/src/Cli/dotnet/commands/dotnet-tool/uninstall/ToolUninstallLocalCommand.cs b/src/Cli/dotnet/commands/dotnet-tool/uninstall/ToolUninstallLocalCommand.cs
index 71bdd7844d63..f658e0d420c0 100644
--- a/src/Cli/dotnet/commands/dotnet-tool/uninstall/ToolUninstallLocalCommand.cs
+++ b/src/Cli/dotnet/commands/dotnet-tool/uninstall/ToolUninstallLocalCommand.cs
@@ -29,8 +29,8 @@ public ToolUninstallLocalCommand(
IReporter reporter = null)
: base(parseResult)
{
- _packageId = new PackageId(parseResult.GetValueForArgument(ToolUninstallCommandParser.PackageIdArgument));
- _explicitManifestFile = parseResult.GetValueForOption(ToolUninstallCommandParser.ToolManifestOption);
+ _packageId = new PackageId(parseResult.GetValue(ToolUninstallCommandParser.PackageIdArgument));
+ _explicitManifestFile = parseResult.GetValue(ToolUninstallCommandParser.ToolManifestOption);
_reporter = (reporter ?? Reporter.Output);
diff --git a/src/Cli/dotnet/commands/dotnet-tool/update/ToolUpdateCommand.cs b/src/Cli/dotnet/commands/dotnet-tool/update/ToolUpdateCommand.cs
index cc8216b2ad70..dc9920e0bdd6 100644
--- a/src/Cli/dotnet/commands/dotnet-tool/update/ToolUpdateCommand.cs
+++ b/src/Cli/dotnet/commands/dotnet-tool/update/ToolUpdateCommand.cs
@@ -31,8 +31,8 @@ public ToolUpdateCommand(
toolUpdateGlobalOrToolPathCommand
?? new ToolUpdateGlobalOrToolPathCommand(result);
- _global = result.GetValueForOption(ToolUpdateCommandParser.GlobalOption);
- _toolPath = result.GetValueForOption(ToolUpdateCommandParser.ToolPathOption);
+ _global = result.GetValue(ToolUpdateCommandParser.GlobalOption);
+ _toolPath = result.GetValue(ToolUpdateCommandParser.ToolPathOption);
}
public override int Execute()
diff --git a/src/Cli/dotnet/commands/dotnet-tool/update/ToolUpdateGlobalOrToolPathCommand.cs b/src/Cli/dotnet/commands/dotnet-tool/update/ToolUpdateGlobalOrToolPathCommand.cs
index 4fa5b150e8c8..6ada60464486 100644
--- a/src/Cli/dotnet/commands/dotnet-tool/update/ToolUpdateGlobalOrToolPathCommand.cs
+++ b/src/Cli/dotnet/commands/dotnet-tool/update/ToolUpdateGlobalOrToolPathCommand.cs
@@ -49,14 +49,14 @@ public ToolUpdateGlobalOrToolPathCommand(ParseResult parseResult,
IReporter reporter = null)
: base(parseResult)
{
- _packageId = new PackageId(parseResult.GetValueForArgument(ToolUninstallCommandParser.PackageIdArgument));
- _configFilePath = parseResult.GetValueForOption(ToolUpdateCommandParser.ConfigOption);
- _framework = parseResult.GetValueForOption(ToolUpdateCommandParser.FrameworkOption);
- _additionalFeeds = parseResult.GetValueForOption(ToolUpdateCommandParser.AddSourceOption);
- _packageVersion = parseResult.GetValueForOption(ToolUpdateCommandParser.VersionOption);
- _global = parseResult.GetValueForOption(ToolUpdateCommandParser.GlobalOption);
- _verbosity = Enum.GetName(parseResult.GetValueForOption(ToolUpdateCommandParser.VerbosityOption));
- _toolPath = parseResult.GetValueForOption(ToolUpdateCommandParser.ToolPathOption);
+ _packageId = new PackageId(parseResult.GetValue(ToolUninstallCommandParser.PackageIdArgument));
+ _configFilePath = parseResult.GetValue(ToolUpdateCommandParser.ConfigOption);
+ _framework = parseResult.GetValue(ToolUpdateCommandParser.FrameworkOption);
+ _additionalFeeds = parseResult.GetValue(ToolUpdateCommandParser.AddSourceOption);
+ _packageVersion = parseResult.GetValue(ToolUpdateCommandParser.VersionOption);
+ _global = parseResult.GetValue(ToolUpdateCommandParser.GlobalOption);
+ _verbosity = Enum.GetName(parseResult.GetValue(ToolUpdateCommandParser.VerbosityOption));
+ _toolPath = parseResult.GetValue(ToolUpdateCommandParser.ToolPathOption);
_forwardRestoreArguments = parseResult.OptionValuesToBeForwarded(ToolUpdateCommandParser.GetCommand());
_createToolPackageStoreInstallerUninstaller = createToolPackageStoreInstallerUninstaller ??
diff --git a/src/Cli/dotnet/commands/dotnet-tool/update/ToolUpdateLocalCommand.cs b/src/Cli/dotnet/commands/dotnet-tool/update/ToolUpdateLocalCommand.cs
index 42e9d3fc827e..eab2f40b32ea 100644
--- a/src/Cli/dotnet/commands/dotnet-tool/update/ToolUpdateLocalCommand.cs
+++ b/src/Cli/dotnet/commands/dotnet-tool/update/ToolUpdateLocalCommand.cs
@@ -38,8 +38,8 @@ public ToolUpdateLocalCommand(
IReporter reporter = null)
: base(parseResult)
{
- _packageId = new PackageId(parseResult.GetValueForArgument(ToolUpdateCommandParser.PackageIdArgument));
- _explicitManifestFile = parseResult.GetValueForOption(ToolUpdateCommandParser.ToolManifestOption);
+ _packageId = new PackageId(parseResult.GetValue(ToolUpdateCommandParser.PackageIdArgument));
+ _explicitManifestFile = parseResult.GetValue(ToolUpdateCommandParser.ToolManifestOption);
_reporter = (reporter ?? Reporter.Output);
diff --git a/src/Cli/dotnet/commands/dotnet-vstest/Program.cs b/src/Cli/dotnet/commands/dotnet-vstest/Program.cs
index 09ecd755e70f..8095afbc15e0 100644
--- a/src/Cli/dotnet/commands/dotnet-vstest/Program.cs
+++ b/src/Cli/dotnet/commands/dotnet-vstest/Program.cs
@@ -48,7 +48,7 @@ private static string[] GetArgs(ParseResult parseResult)
if (parseResult.HasOption(CommonOptions.TestLoggerOption))
{
// System command line might have mutated the options, reformat test logger option so vstest recognizes it
- string loggerValue = parseResult.GetValueForOption(CommonOptions.TestLoggerOption);
+ string loggerValue = parseResult.GetValue(CommonOptions.TestLoggerOption);
args = args.Where(a => !a.Equals(loggerValue) && !CommonOptions.TestLoggerOption.Aliases.Contains(a));
args = args.Prepend($"{CommonOptions.TestLoggerOption.Aliases.First()}:{loggerValue}");
}
diff --git a/src/Cli/dotnet/commands/dotnet-workload/WorkloadCommandBase.cs b/src/Cli/dotnet/commands/dotnet-workload/WorkloadCommandBase.cs
index dc4cd2d3f51d..3b7bc559639a 100644
--- a/src/Cli/dotnet/commands/dotnet-workload/WorkloadCommandBase.cs
+++ b/src/Cli/dotnet/commands/dotnet-workload/WorkloadCommandBase.cs
@@ -92,8 +92,8 @@ public WorkloadCommandBase(ParseResult parseResult,
RestoreActionConfiguration = _parseResult.ToRestoreActionConfig();
Verbosity = verbosityOptions == null
- ? parseResult.GetValueForOption(CommonOptions.VerbosityOption)
- : parseResult.GetValueForOption(verbosityOptions);
+ ? parseResult.GetValue(CommonOptions.VerbosityOption)
+ : parseResult.GetValue(verbosityOptions);
ILogger nugetLogger = Verbosity.IsDetailedOrDiagnostic() ? new NuGetConsoleLogger() : new NullLogger();
@@ -101,8 +101,8 @@ public WorkloadCommandBase(ParseResult parseResult,
TempDirectoryPath = !string.IsNullOrWhiteSpace(tempDirPath)
? tempDirPath
- : !string.IsNullOrWhiteSpace(parseResult.GetValueForOption(WorkloadInstallCommandParser.TempDirOption))
- ? parseResult.GetValueForOption(WorkloadInstallCommandParser.TempDirOption)
+ : !string.IsNullOrWhiteSpace(parseResult.GetValue(WorkloadInstallCommandParser.TempDirOption))
+ ? parseResult.GetValue(WorkloadInstallCommandParser.TempDirOption)
: PathUtilities.CreateTempSubdirectory();
TempPackagesDirectory = new DirectoryPath(Path.Combine(TempDirectoryPath, "dotnet-sdk-advertising-temp"));
@@ -131,7 +131,7 @@ private static bool ShouldVerifySignatures(ParseResult parseResult)
return false;
}
- bool skipSignCheck = parseResult.GetValueForOption(WorkloadInstallCommandParser.SkipSignCheckOption);
+ bool skipSignCheck = parseResult.GetValue(WorkloadInstallCommandParser.SkipSignCheckOption);
bool policyEnabled = SignCheck.IsWorkloadSignVerificationPolicySet();
if (skipSignCheck && policyEnabled)
diff --git a/src/Cli/dotnet/commands/dotnet-workload/WorkloadCommandNuGetRestoreActionConfigOptions.cs b/src/Cli/dotnet/commands/dotnet-workload/WorkloadCommandNuGetRestoreActionConfigOptions.cs
index 15634985a5e0..ff48491ced54 100644
--- a/src/Cli/dotnet/commands/dotnet-workload/WorkloadCommandNuGetRestoreActionConfigOptions.cs
+++ b/src/Cli/dotnet/commands/dotnet-workload/WorkloadCommandNuGetRestoreActionConfigOptions.cs
@@ -46,10 +46,10 @@ internal static class WorkloadCommandNuGetRestoreActionConfigOptions
public static RestoreActionConfig ToRestoreActionConfig(this ParseResult parseResult)
{
- return new RestoreActionConfig(DisableParallel: parseResult.GetValueForOption(DisableParallelOption),
- NoCache: parseResult.GetValueForOption(NoCacheOption),
- IgnoreFailedSources: parseResult.GetValueForOption(IgnoreFailedSourcesOption),
- Interactive: parseResult.GetValueForOption(InteractiveRestoreOption));
+ return new RestoreActionConfig(DisableParallel: parseResult.GetValue(DisableParallelOption),
+ NoCache: parseResult.GetValue(NoCacheOption),
+ IgnoreFailedSources: parseResult.GetValue(IgnoreFailedSourcesOption),
+ Interactive: parseResult.GetValue(InteractiveRestoreOption));
}
public static void AddWorkloadCommandNuGetRestoreActionConfigOptions(this Command command, bool Hide = false)
diff --git a/src/Cli/dotnet/commands/dotnet-workload/install/WorkloadInstallCommand.cs b/src/Cli/dotnet/commands/dotnet-workload/install/WorkloadInstallCommand.cs
index b1c0ebacc9a0..7301d1b1f5a7 100644
--- a/src/Cli/dotnet/commands/dotnet-workload/install/WorkloadInstallCommand.cs
+++ b/src/Cli/dotnet/commands/dotnet-workload/install/WorkloadInstallCommand.cs
@@ -47,8 +47,8 @@ public WorkloadInstallCommand(
nugetPackageDownloader: nugetPackageDownloader, workloadManifestUpdater: workloadManifestUpdater,
dotnetDir: dotnetDir, userProfileDir: userProfileDir, tempDirPath: tempDirPath, version: version, installedFeatureBand: installedFeatureBand)
{
- _skipManifestUpdate = parseResult.GetValueForOption(WorkloadInstallCommandParser.SkipManifestUpdateOption);
- _workloadIds = workloadIds ?? parseResult.GetValueForArgument(WorkloadInstallCommandParser.WorkloadIdArgument).ToList().AsReadOnly();
+ _skipManifestUpdate = parseResult.GetValue(WorkloadInstallCommandParser.SkipManifestUpdateOption);
+ _workloadIds = workloadIds ?? parseResult.GetValue(WorkloadInstallCommandParser.WorkloadIdArgument).ToList().AsReadOnly();
_workloadInstaller = _workloadInstallerFromConstructor ??
WorkloadInstallerFactory.GetWorkloadInstaller(Reporter, _sdkFeatureBand,
diff --git a/src/Cli/dotnet/commands/dotnet-workload/list/WorkloadListCommand.cs b/src/Cli/dotnet/commands/dotnet-workload/list/WorkloadListCommand.cs
index 298a54f52dfe..751bb43b68b1 100644
--- a/src/Cli/dotnet/commands/dotnet-workload/list/WorkloadListCommand.cs
+++ b/src/Cli/dotnet/commands/dotnet-workload/list/WorkloadListCommand.cs
@@ -40,7 +40,7 @@ public WorkloadListCommand(
{
_workloadListHelper = new WorkloadInfoHelper(
Verbosity,
- result?.GetValueForOption(WorkloadListCommandParser.VersionOption) ?? null,
+ result?.GetValue(WorkloadListCommandParser.VersionOption) ?? null,
VerifySignatures,
Reporter,
workloadRecordRepo,
@@ -50,9 +50,9 @@ public WorkloadListCommand(
workloadResolver
);
- _machineReadableOption = result.GetValueForOption(WorkloadListCommandParser.MachineReadableOption);
+ _machineReadableOption = result.GetValue(WorkloadListCommandParser.MachineReadableOption);
- _includePreviews = result.GetValueForOption(WorkloadListCommandParser.IncludePreviewsOption);
+ _includePreviews = result.GetValue(WorkloadListCommandParser.IncludePreviewsOption);
string userProfileDir1 = userProfileDir ?? CliFolderPathCalculator.DotnetUserProfileFolderPath;
_workloadManifestUpdater = workloadManifestUpdater ?? new WorkloadManifestUpdater(Reporter,
diff --git a/src/Cli/dotnet/commands/dotnet-workload/repair/WorkloadRepairCommand.cs b/src/Cli/dotnet/commands/dotnet-workload/repair/WorkloadRepairCommand.cs
index 1aba15b3dfec..4546c2e60056 100644
--- a/src/Cli/dotnet/commands/dotnet-workload/repair/WorkloadRepairCommand.cs
+++ b/src/Cli/dotnet/commands/dotnet-workload/repair/WorkloadRepairCommand.cs
@@ -42,10 +42,10 @@ public WorkloadRepairCommand(
{
_dotnetPath = dotnetDir ?? Path.GetDirectoryName(Environment.ProcessPath);
userProfileDir ??= CliFolderPathCalculator.DotnetUserProfileFolderPath;
- _sdkVersion = WorkloadOptionsExtensions.GetValidatedSdkVersion(parseResult.GetValueForOption(WorkloadRepairCommandParser.VersionOption), version, _dotnetPath, userProfileDir, true);
+ _sdkVersion = WorkloadOptionsExtensions.GetValidatedSdkVersion(parseResult.GetValue(WorkloadRepairCommandParser.VersionOption), version, _dotnetPath, userProfileDir, true);
- var configOption = parseResult.GetValueForOption(WorkloadRepairCommandParser.ConfigOption);
- var sourceOption = parseResult.GetValueForOption(WorkloadRepairCommandParser.SourceOption);
+ var configOption = parseResult.GetValue(WorkloadRepairCommandParser.ConfigOption);
+ var sourceOption = parseResult.GetValue(WorkloadRepairCommandParser.SourceOption);
_packageSourceLocation = string.IsNullOrEmpty(configOption) && (sourceOption == null || !sourceOption.Any()) ? null :
new PackageSourceLocation(string.IsNullOrEmpty(configOption) ? null : new FilePath(configOption), sourceFeedOverrides: sourceOption);
diff --git a/src/Cli/dotnet/commands/dotnet-workload/restore/WorkloadRestoreCommand.cs b/src/Cli/dotnet/commands/dotnet-workload/restore/WorkloadRestoreCommand.cs
index 916792432e44..6a06288980e5 100644
--- a/src/Cli/dotnet/commands/dotnet-workload/restore/WorkloadRestoreCommand.cs
+++ b/src/Cli/dotnet/commands/dotnet-workload/restore/WorkloadRestoreCommand.cs
@@ -33,7 +33,7 @@ public WorkloadRestoreCommand(
{
_result = result;
_slnOrProjectArgument =
- result.GetValueForArgument(RestoreCommandParser.SlnOrProjectArgument);
+ result.GetValue(RestoreCommandParser.SlnOrProjectArgument);
}
public override int Execute()
diff --git a/src/Cli/dotnet/commands/dotnet-workload/search/WorkloadSearchCommand.cs b/src/Cli/dotnet/commands/dotnet-workload/search/WorkloadSearchCommand.cs
index 88fac779d565..9c7d41bad470 100644
--- a/src/Cli/dotnet/commands/dotnet-workload/search/WorkloadSearchCommand.cs
+++ b/src/Cli/dotnet/commands/dotnet-workload/search/WorkloadSearchCommand.cs
@@ -29,10 +29,10 @@ public WorkloadSearchCommand(
string version = null,
string userProfileDir = null) : base(result, CommonOptions.HiddenVerbosityOption, reporter)
{
- _workloadIdStub = result.GetValueForArgument(WorkloadSearchCommandParser.WorkloadIdStubArgument);
+ _workloadIdStub = result.GetValue(WorkloadSearchCommandParser.WorkloadIdStubArgument);
var dotnetPath = Path.GetDirectoryName(Environment.ProcessPath);
userProfileDir ??= CliFolderPathCalculator.DotnetUserProfileFolderPath;
- _sdkVersion = WorkloadOptionsExtensions.GetValidatedSdkVersion(result.GetValueForOption(WorkloadSearchCommandParser.VersionOption), version, dotnetPath, userProfileDir, true);
+ _sdkVersion = WorkloadOptionsExtensions.GetValidatedSdkVersion(result.GetValue(WorkloadSearchCommandParser.VersionOption), version, dotnetPath, userProfileDir, true);
var workloadManifestProvider = new SdkDirectoryWorkloadManifestProvider(dotnetPath, _sdkVersion.ToString(), userProfileDir);
_workloadResolver = workloadResolver ?? WorkloadResolver.Create(workloadManifestProvider, dotnetPath, _sdkVersion.ToString(), userProfileDir);
}
diff --git a/src/Cli/dotnet/commands/dotnet-workload/uninstall/WorkloadUninstallCommand.cs b/src/Cli/dotnet/commands/dotnet-workload/uninstall/WorkloadUninstallCommand.cs
index 6bb77c3baa54..59b035669f6f 100644
--- a/src/Cli/dotnet/commands/dotnet-workload/uninstall/WorkloadUninstallCommand.cs
+++ b/src/Cli/dotnet/commands/dotnet-workload/uninstall/WorkloadUninstallCommand.cs
@@ -37,11 +37,11 @@ public WorkloadUninstallCommand(
string userProfileDir = null)
: base(parseResult, reporter: reporter, nugetPackageDownloader: nugetPackageDownloader)
{
- _workloadIds = parseResult.GetValueForArgument(WorkloadUninstallCommandParser.WorkloadIdArgument)
+ _workloadIds = parseResult.GetValue(WorkloadUninstallCommandParser.WorkloadIdArgument)
.Select(workloadId => new WorkloadId(workloadId)).ToList().AsReadOnly();
var dotnetPath = dotnetDir ?? Path.GetDirectoryName(Environment.ProcessPath);
userProfileDir = userProfileDir ?? CliFolderPathCalculator.DotnetUserProfileFolderPath;
- _sdkVersion = WorkloadOptionsExtensions.GetValidatedSdkVersion(parseResult.GetValueForOption(WorkloadUninstallCommandParser.VersionOption), version, dotnetPath, userProfileDir, true);
+ _sdkVersion = WorkloadOptionsExtensions.GetValidatedSdkVersion(parseResult.GetValue(WorkloadUninstallCommandParser.VersionOption), version, dotnetPath, userProfileDir, true);
var workloadManifestProvider = new SdkDirectoryWorkloadManifestProvider(dotnetPath, _sdkVersion.ToString(), userProfileDir);
workloadResolver ??= WorkloadResolver.Create(workloadManifestProvider, dotnetPath, _sdkVersion.ToString(), userProfileDir);
diff --git a/src/Cli/dotnet/commands/dotnet-workload/update/WorkloadUpdateCommand.cs b/src/Cli/dotnet/commands/dotnet-workload/update/WorkloadUpdateCommand.cs
index 8dc4c083834c..ee625a3883ef 100644
--- a/src/Cli/dotnet/commands/dotnet-workload/update/WorkloadUpdateCommand.cs
+++ b/src/Cli/dotnet/commands/dotnet-workload/update/WorkloadUpdateCommand.cs
@@ -47,9 +47,9 @@ public WorkloadUpdateCommand(
dotnetDir: dotnetDir, userProfileDir: userProfileDir, tempDirPath: tempDirPath, version: version, installedFeatureBand: installedFeatureBand)
{
- _fromPreviousSdk = parseResult.GetValueForOption(WorkloadUpdateCommandParser.FromPreviousSdkOption);
- _adManifestOnlyOption = parseResult.GetValueForOption(WorkloadUpdateCommandParser.AdManifestOnlyOption);
- _printRollbackDefinitionOnly = parseResult.GetValueForOption(WorkloadUpdateCommandParser.PrintRollbackOption);
+ _fromPreviousSdk = parseResult.GetValue(WorkloadUpdateCommandParser.FromPreviousSdkOption);
+ _adManifestOnlyOption = parseResult.GetValue(WorkloadUpdateCommandParser.AdManifestOnlyOption);
+ _printRollbackDefinitionOnly = parseResult.GetValue(WorkloadUpdateCommandParser.PrintRollbackOption);
_workloadInstaller = _workloadInstallerFromConstructor ?? WorkloadInstallerFactory.GetWorkloadInstaller(Reporter,
_sdkFeatureBand, workloadResolver ?? _workloadResolver, Verbosity, _userProfileDir, VerifySignatures, PackageDownloader,
diff --git a/src/GenAPI/Microsoft.DotNet.GenAPI.Tool/Program.cs b/src/GenAPI/Microsoft.DotNet.GenAPI.Tool/Program.cs
index d3855b7805c4..1bd5caec2eab 100644
--- a/src/GenAPI/Microsoft.DotNet.GenAPI.Tool/Program.cs
+++ b/src/GenAPI/Microsoft.DotNet.GenAPI.Tool/Program.cs
@@ -66,13 +66,13 @@ static int Main(string[] args)
rootCommand.SetHandler((InvocationContext context) =>
{
GenAPIApp.Run(new GenAPIApp.Context(
- context.ParseResult.GetValueForOption(assembliesOption)!,
- context.ParseResult.GetValueForOption(assemblyReferencesOption),
- context.ParseResult.GetValueForOption(exceptionMessageOption),
- context.ParseResult.GetValueForOption(headerFileOption),
- context.ParseResult.GetValueForOption(outputPathOption),
- context.ParseResult.GetValueForOption(excludeAttributesFilesOption),
- context.ParseResult.GetValueForOption(includeVisibleOutsideOfAssembly)
+ context.ParseResult.GetValue(assembliesOption)!,
+ context.ParseResult.GetValue(assemblyReferencesOption),
+ context.ParseResult.GetValue(exceptionMessageOption),
+ context.ParseResult.GetValue(headerFileOption),
+ context.ParseResult.GetValue(outputPathOption),
+ context.ParseResult.GetValue(excludeAttributesFilesOption),
+ context.ParseResult.GetValue(includeVisibleOutsideOfAssembly)
));
});
diff --git a/src/Tests/Microsoft.TemplateEngine.Cli.UnitTests/ParserTests/MiscTests.cs b/src/Tests/Microsoft.TemplateEngine.Cli.UnitTests/ParserTests/MiscTests.cs
index 6dbe7853bd22..f2d0f26efb68 100644
--- a/src/Tests/Microsoft.TemplateEngine.Cli.UnitTests/ParserTests/MiscTests.cs
+++ b/src/Tests/Microsoft.TemplateEngine.Cli.UnitTests/ParserTests/MiscTests.cs
@@ -161,7 +161,7 @@ public void ManuallyAddedOptionIsPreservedOnTemplateSubcommandLevel()
Assert.NotNull(args.ParseResult);
Assert.Equal("console", args.ShortName);
Assert.Empty(args.RemainingArguments);
- Assert.Equal("val", args.ParseResult.GetValueForOption(customOption));
+ Assert.Equal("val", args.ParseResult.GetValue(customOption));
}
[Theory]
@@ -181,7 +181,7 @@ public void CanParseOutputOption(string command, string? expected)
rootCommand.Add(myCommand);
ParseResult parseResult = rootCommand.Parse(command);
- Assert.Equal(expected, parseResult.GetValueForOption(SharedOptions.OutputOption)?.Name);
+ Assert.Equal(expected, parseResult.GetValue(SharedOptions.OutputOption)?.Name);
}
[Theory]
@@ -199,7 +199,7 @@ public void CanParseProjectOption(string command, string? expected)
rootCommand.Add(myCommand);
ParseResult parseResult = rootCommand.Parse(command);
- Assert.Equal(expected, parseResult.GetValueForOption(SharedOptions.ProjectPathOption)?.Name);
+ Assert.Equal(expected, parseResult.GetValue(SharedOptions.ProjectPathOption)?.Name);
}
}
}
diff --git a/src/Tests/Microsoft.TemplateEngine.EndToEndTestHarness/Program.cs b/src/Tests/Microsoft.TemplateEngine.EndToEndTestHarness/Program.cs
index a43df3ffa706..7327fd777860 100644
--- a/src/Tests/Microsoft.TemplateEngine.EndToEndTestHarness/Program.cs
+++ b/src/Tests/Microsoft.TemplateEngine.EndToEndTestHarness/Program.cs
@@ -51,7 +51,7 @@ private static int Main(string[] args)
CommandName,
(ParseResult parseResult) =>
{
- FileInfo outputPath = parseResult.GetValueForOption(SharedOptions.OutputOption);
+ FileInfo outputPath = parseResult.GetValue(SharedOptions.OutputOption);
host = CreateHost(testAssetsRoot, outputPath?.FullName);
return host;
});
diff --git a/src/Tests/dotnet.Tests/ParserTests/AddReferenceParserTests.cs b/src/Tests/dotnet.Tests/ParserTests/AddReferenceParserTests.cs
index eb285eef98b4..46993fc8de49 100644
--- a/src/Tests/dotnet.Tests/ParserTests/AddReferenceParserTests.cs
+++ b/src/Tests/dotnet.Tests/ParserTests/AddReferenceParserTests.cs
@@ -30,7 +30,7 @@ public void AddReferenceHasDefaultArgumentSetToCurrentDirectory()
{
var result = Parser.Instance.Parse("dotnet add reference my.csproj");
- result.GetValueForArgument(AddCommandParser.ProjectArgument)
+ result.GetValue(AddCommandParser.ProjectArgument)
.Should()
.BeEquivalentTo(
PathUtility.EnsureTrailingSlash(Directory.GetCurrentDirectory()));
@@ -41,7 +41,7 @@ public void AddReferenceHasInteractiveFlag()
{
var result = Parser.Instance.Parse("dotnet add reference my.csproj --interactive");
- result.GetValueForOption(AddProjectToProjectReferenceParser.InteractiveOption)
+ result.GetValue(AddProjectToProjectReferenceParser.InteractiveOption)
.Should().BeTrue();
}
@@ -50,7 +50,7 @@ public void AddReferenceDoesNotHaveInteractiveFlagByDefault()
{
var result = Parser.Instance.Parse("dotnet add reference my.csproj");
- result.GetValueForOption(AddProjectToProjectReferenceParser.InteractiveOption)
+ result.GetValue(AddProjectToProjectReferenceParser.InteractiveOption)
.Should().BeFalse();
}
diff --git a/src/Tests/dotnet.Tests/ParserTests/BuildServerShutdownParserTests.cs b/src/Tests/dotnet.Tests/ParserTests/BuildServerShutdownParserTests.cs
index ded7d29588d6..41fafbfc9cf3 100644
--- a/src/Tests/dotnet.Tests/ParserTests/BuildServerShutdownParserTests.cs
+++ b/src/Tests/dotnet.Tests/ParserTests/BuildServerShutdownParserTests.cs
@@ -25,9 +25,9 @@ public void GivenNoOptionsAllFlagsAreFalse()
{
var result = Parser.Instance.Parse("dotnet build-server shutdown");
- result.GetValueForOption(ServerShutdownCommandParser.MSBuildOption).Should().Be(false);
- result.GetValueForOption(ServerShutdownCommandParser.VbcsOption).Should().Be(false);
- result.GetValueForOption(ServerShutdownCommandParser.RazorOption).Should().Be(false);
+ result.GetValue(ServerShutdownCommandParser.MSBuildOption).Should().Be(false);
+ result.GetValue(ServerShutdownCommandParser.VbcsOption).Should().Be(false);
+ result.GetValue(ServerShutdownCommandParser.RazorOption).Should().Be(false);
}
[Fact]
@@ -35,9 +35,9 @@ public void GivenMSBuildOptionIsItTrue()
{
var result = Parser.Instance.Parse("dotnet build-server shutdown --msbuild");
- result.GetValueForOption(ServerShutdownCommandParser.MSBuildOption).Should().Be(true);
- result.GetValueForOption(ServerShutdownCommandParser.VbcsOption).Should().Be(false);
- result.GetValueForOption(ServerShutdownCommandParser.RazorOption).Should().Be(false);
+ result.GetValue(ServerShutdownCommandParser.MSBuildOption).Should().Be(true);
+ result.GetValue(ServerShutdownCommandParser.VbcsOption).Should().Be(false);
+ result.GetValue(ServerShutdownCommandParser.RazorOption).Should().Be(false);
}
[Fact]
@@ -45,9 +45,9 @@ public void GivenVBCSCompilerOptionIsItTrue()
{
var result = Parser.Instance.Parse("dotnet build-server shutdown --vbcscompiler");
- result.GetValueForOption(ServerShutdownCommandParser.MSBuildOption).Should().Be(false);
- result.GetValueForOption(ServerShutdownCommandParser.VbcsOption).Should().Be(true);
- result.GetValueForOption(ServerShutdownCommandParser.RazorOption).Should().Be(false);
+ result.GetValue(ServerShutdownCommandParser.MSBuildOption).Should().Be(false);
+ result.GetValue(ServerShutdownCommandParser.VbcsOption).Should().Be(true);
+ result.GetValue(ServerShutdownCommandParser.RazorOption).Should().Be(false);
}
[Fact]
@@ -55,9 +55,9 @@ public void GivenRazorOptionIsItTrue()
{
var result = Parser.Instance.Parse("dotnet build-server shutdown --razor");
- result.GetValueForOption(ServerShutdownCommandParser.MSBuildOption).Should().Be(false);
- result.GetValueForOption(ServerShutdownCommandParser.VbcsOption).Should().Be(false);
- result.GetValueForOption(ServerShutdownCommandParser.RazorOption).Should().Be(true);
+ result.GetValue(ServerShutdownCommandParser.MSBuildOption).Should().Be(false);
+ result.GetValue(ServerShutdownCommandParser.VbcsOption).Should().Be(false);
+ result.GetValue(ServerShutdownCommandParser.RazorOption).Should().Be(true);
}
[Fact]
@@ -65,9 +65,9 @@ public void GivenMultipleOptionsThoseAreTrue()
{
var result = Parser.Instance.Parse("dotnet build-server shutdown --razor --msbuild");
- result.GetValueForOption(ServerShutdownCommandParser.MSBuildOption).Should().Be(true);
- result.GetValueForOption(ServerShutdownCommandParser.VbcsOption).Should().Be(false);
- result.GetValueForOption(ServerShutdownCommandParser.RazorOption).Should().Be(true);
+ result.GetValue(ServerShutdownCommandParser.MSBuildOption).Should().Be(true);
+ result.GetValue(ServerShutdownCommandParser.VbcsOption).Should().Be(false);
+ result.GetValue(ServerShutdownCommandParser.RazorOption).Should().Be(true);
}
}
}
diff --git a/src/Tests/dotnet.Tests/ParserTests/InstallToolParserTests.cs b/src/Tests/dotnet.Tests/ParserTests/InstallToolParserTests.cs
index be793f3af93f..b0c28d87db94 100644
--- a/src/Tests/dotnet.Tests/ParserTests/InstallToolParserTests.cs
+++ b/src/Tests/dotnet.Tests/ParserTests/InstallToolParserTests.cs
@@ -29,8 +29,8 @@ public void InstallGlobaltoolParserCanGetPackageIdAndPackageVersion()
{
var result = Parser.Instance.Parse("dotnet tool install -g console.test.app --version 1.0.1");
- var packageId = result.GetValueForArgument(ToolInstallCommandParser.PackageIdArgument);
- var packageVersion = result.GetValueForOption(ToolInstallCommandParser.VersionOption);
+ var packageId = result.GetValue(ToolInstallCommandParser.PackageIdArgument);
+ var packageVersion = result.GetValue(ToolInstallCommandParser.VersionOption);
packageId.Should().Be("console.test.app");
packageVersion.Should().Be("1.0.1");
@@ -43,8 +43,8 @@ public void InstallGlobaltoolParserCanGetFollowingArguments()
Parser.Instance.Parse(
$@"dotnet tool install -g console.test.app --version 1.0.1 --framework {ToolsetInfo.CurrentTargetFramework} --configfile C:\TestAssetLocalNugetFeed");
- result.GetValueForOption(ToolInstallCommandParser.ConfigOption).Should().Be(@"C:\TestAssetLocalNugetFeed");
- result.GetValueForOption(ToolInstallCommandParser.FrameworkOption).Should().Be(ToolsetInfo.CurrentTargetFramework);
+ result.GetValue(ToolInstallCommandParser.ConfigOption).Should().Be(@"C:\TestAssetLocalNugetFeed");
+ result.GetValue(ToolInstallCommandParser.FrameworkOption).Should().Be(ToolsetInfo.CurrentTargetFramework);
}
[Fact]
@@ -55,7 +55,7 @@ public void InstallToolParserCanParseSourceOption()
var result =
Parser.Instance.Parse($"dotnet tool install -g --add-source {expectedSourceValue} console.test.app");
- result.GetValueForOption(ToolInstallCommandParser.AddSourceOption).First().Should().Be(expectedSourceValue);
+ result.GetValue(ToolInstallCommandParser.AddSourceOption).First().Should().Be(expectedSourceValue);
}
[Fact]
@@ -71,8 +71,8 @@ public void InstallToolParserCanParseMultipleSourceOption()
$"--add-source {expectedSourceValue2} console.test.app");
- result.GetValueForOption(ToolInstallCommandParser.AddSourceOption)[0].Should().Be(expectedSourceValue1);
- result.GetValueForOption(ToolInstallCommandParser.AddSourceOption)[1].Should().Be(expectedSourceValue2);
+ result.GetValue(ToolInstallCommandParser.AddSourceOption)[0].Should().Be(expectedSourceValue1);
+ result.GetValue(ToolInstallCommandParser.AddSourceOption)[1].Should().Be(expectedSourceValue2);
}
[Fact]
@@ -80,7 +80,7 @@ public void InstallToolParserCanGetGlobalOption()
{
var result = Parser.Instance.Parse("dotnet tool install -g console.test.app");
- result.GetValueForOption(ToolInstallCommandParser.GlobalOption).Should().Be(true);
+ result.GetValue(ToolInstallCommandParser.GlobalOption).Should().Be(true);
}
[Fact]
@@ -88,7 +88,7 @@ public void InstallToolParserCanGetLocalOption()
{
var result = Parser.Instance.Parse("dotnet tool install --local console.test.app");
- result.GetValueForOption(ToolInstallCommandParser.LocalOption).Should().Be(true);
+ result.GetValue(ToolInstallCommandParser.LocalOption).Should().Be(true);
}
[Fact]
@@ -98,7 +98,7 @@ public void InstallToolParserCanGetManifestOption()
Parser.Instance.Parse(
"dotnet tool install --local console.test.app --tool-manifest folder/my-manifest.format");
- result.GetValueForOption(ToolInstallCommandParser.ToolManifestOption).Should().Be("folder/my-manifest.format");
+ result.GetValue(ToolInstallCommandParser.ToolManifestOption).Should().Be("folder/my-manifest.format");
}
[Fact]
@@ -108,7 +108,7 @@ public void InstallToolParserCanParseVerbosityOption()
var result = Parser.Instance.Parse($"dotnet tool install -g --verbosity:{expectedVerbosityLevel} console.test.app");
- Enum.GetName(result.GetValueForOption(ToolInstallCommandParser.VerbosityOption)).Should().Be(expectedVerbosityLevel);
+ Enum.GetName(result.GetValue(ToolInstallCommandParser.VerbosityOption)).Should().Be(expectedVerbosityLevel);
}
[Fact]
@@ -117,7 +117,7 @@ public void InstallToolParserCanParseToolPathOption()
var result =
Parser.Instance.Parse(@"dotnet tool install --tool-path C:\Tools console.test.app");
- result.GetValueForOption(ToolInstallCommandParser.ToolPathOption).Should().Be(@"C:\Tools");
+ result.GetValue(ToolInstallCommandParser.ToolPathOption).Should().Be(@"C:\Tools");
}
[Fact]
diff --git a/src/Tests/dotnet.Tests/ParserTests/ListToolParserTests.cs b/src/Tests/dotnet.Tests/ParserTests/ListToolParserTests.cs
index b32b97fffbdd..69629caacb94 100644
--- a/src/Tests/dotnet.Tests/ParserTests/ListToolParserTests.cs
+++ b/src/Tests/dotnet.Tests/ParserTests/ListToolParserTests.cs
@@ -25,7 +25,7 @@ public void ListToolParserCanGetGlobalOption()
{
var result = Parser.Instance.Parse("dotnet tool list -g");
- result.GetValueForOption(ToolListCommandParser.GlobalOption).Should().Be(true);
+ result.GetValue(ToolListCommandParser.GlobalOption).Should().Be(true);
}
[Fact]
@@ -33,7 +33,7 @@ public void ListToolParserCanGetLocalOption()
{
var result = Parser.Instance.Parse("dotnet tool list --local");
- result.GetValueForOption(ToolListCommandParser.LocalOption).Should().Be(true);
+ result.GetValue(ToolListCommandParser.LocalOption).Should().Be(true);
}
[Fact]
@@ -42,7 +42,7 @@ public void ListToolParserCanParseToolPathOption()
var result =
Parser.Instance.Parse(@"dotnet tool list --tool-path C:\Tools ");
- result.GetValueForOption(ToolListCommandParser.ToolPathOption).Should().Be(@"C:\Tools");
+ result.GetValue(ToolListCommandParser.ToolPathOption).Should().Be(@"C:\Tools");
}
}
}
diff --git a/src/Tests/dotnet.Tests/ParserTests/RestoreParserTests.cs b/src/Tests/dotnet.Tests/ParserTests/RestoreParserTests.cs
index 7e59b3bebcd9..533db5e76833 100644
--- a/src/Tests/dotnet.Tests/ParserTests/RestoreParserTests.cs
+++ b/src/Tests/dotnet.Tests/ParserTests/RestoreParserTests.cs
@@ -28,7 +28,7 @@ public void RestoreCapturesArgumentsToForwardToMSBuildWhenTargetIsSpecified()
{
var result = Parser.Instance.Parse(@"dotnet restore .\some.csproj --packages c:\.nuget\packages /p:SkipInvalidConfigurations=true");
- result.GetValueForArgument>(RestoreCommandParser.SlnOrProjectArgument).Should().BeEquivalentTo(@".\some.csproj");
+ result.GetValue>(RestoreCommandParser.SlnOrProjectArgument).Should().BeEquivalentTo(@".\some.csproj");
result.OptionValuesToBeForwarded(RestoreCommandParser.GetCommand()).Should().Contain(@"--property:SkipInvalidConfigurations=true");
}
@@ -48,9 +48,9 @@ public void RestoreDistinguishesRepeatSourceArgsFromCommandArgs()
.Parse(
@"dotnet restore --no-cache --packages ""D:\OSS\corefx\packages"" --source https://dotnet.myget.org/F/dotnet-buildtools/api/v3/index.json --source https://dotnet.myget.org/F/dotnet-core/api/v3/index.json --source https://api.nuget.org/v3/index.json D:\OSS\corefx\external\runtime\runtime.depproj");
- restore.GetValueForArgument(RestoreCommandParser.SlnOrProjectArgument);
+ restore.GetValue(RestoreCommandParser.SlnOrProjectArgument);
- restore.GetValueForOption(RestoreCommandParser.SourceOption)
+ restore.GetValue(RestoreCommandParser.SourceOption)
.Should()
.BeEquivalentTo(
"https://dotnet.myget.org/F/dotnet-buildtools/api/v3/index.json",
diff --git a/src/Tests/dotnet.Tests/ParserTests/ToolRestoreParserTests.cs b/src/Tests/dotnet.Tests/ParserTests/ToolRestoreParserTests.cs
index 5913182ab425..59e4779000e7 100644
--- a/src/Tests/dotnet.Tests/ParserTests/ToolRestoreParserTests.cs
+++ b/src/Tests/dotnet.Tests/ParserTests/ToolRestoreParserTests.cs
@@ -27,7 +27,7 @@ public void ToolRestoreParserCanGetManifestFilePath()
{
var result = Parser.Instance.Parse("dotnet tool restore --tool-manifest folder/my-manifest.format");
- result.GetValueForOption(ToolRestoreCommandParser.ToolManifestOption).Should().Be("folder/my-manifest.format");
+ result.GetValue(ToolRestoreCommandParser.ToolManifestOption).Should().Be("folder/my-manifest.format");
}
[Fact]
@@ -37,7 +37,7 @@ public void ToolRestoreParserCanGetFollowingArguments()
Parser.Instance.Parse(
@"dotnet tool restore --configfile C:\TestAssetLocalNugetFeed");
- result.GetValueForOption(ToolRestoreCommandParser.ConfigOption).Should().Be(@"C:\TestAssetLocalNugetFeed");
+ result.GetValue(ToolRestoreCommandParser.ConfigOption).Should().Be(@"C:\TestAssetLocalNugetFeed");
}
[Fact]
@@ -48,7 +48,7 @@ public void ToolRestoreParserCanParseSourceOption()
var result =
Parser.Instance.Parse($"dotnet tool restore --add-source {expectedSourceValue}");
- result.GetValueForOption(ToolRestoreCommandParser.AddSourceOption).First().Should().Be(expectedSourceValue);
+ result.GetValue(ToolRestoreCommandParser.AddSourceOption).First().Should().Be(expectedSourceValue);
}
[Fact]
@@ -63,8 +63,8 @@ public void ToolRestoreParserCanParseMultipleSourceOption()
$"--add-source {expectedSourceValue1} " +
$"--add-source {expectedSourceValue2}");
- result.GetValueForOption(ToolRestoreCommandParser.AddSourceOption)[0].Should().Be(expectedSourceValue1);
- result.GetValueForOption(ToolRestoreCommandParser.AddSourceOption)[1].Should().Be(expectedSourceValue2);
+ result.GetValue(ToolRestoreCommandParser.AddSourceOption)[0].Should().Be(expectedSourceValue1);
+ result.GetValue(ToolRestoreCommandParser.AddSourceOption)[1].Should().Be(expectedSourceValue2);
}
[Fact]
@@ -74,7 +74,7 @@ public void ToolRestoreParserCanParseVerbosityOption()
var result = Parser.Instance.Parse($"dotnet tool restore --verbosity {expectedVerbosityLevel}");
- Enum.GetName(result.GetValueForOption(ToolRestoreCommandParser.VerbosityOption)).Should().Be(expectedVerbosityLevel);
+ Enum.GetName(result.GetValue(ToolRestoreCommandParser.VerbosityOption)).Should().Be(expectedVerbosityLevel);
}
[Fact]
diff --git a/src/Tests/dotnet.Tests/ParserTests/ToolRunParserTests.cs b/src/Tests/dotnet.Tests/ParserTests/ToolRunParserTests.cs
index 677bff0cb975..d05d01c8af63 100644
--- a/src/Tests/dotnet.Tests/ParserTests/ToolRunParserTests.cs
+++ b/src/Tests/dotnet.Tests/ParserTests/ToolRunParserTests.cs
@@ -25,7 +25,7 @@ public void ListToolParserCanGetToolCommandNameArgument()
{
var result = Parser.Instance.Parse("dotnet tool run dotnetsay");
- var packageId = result.GetValueForArgument(ToolRunCommandParser.CommandNameArgument);
+ var packageId = result.GetValue(ToolRunCommandParser.CommandNameArgument);
packageId.Should().Be("dotnetsay");
}
diff --git a/src/Tests/dotnet.Tests/ParserTests/ToolSearchParserTests.cs b/src/Tests/dotnet.Tests/ParserTests/ToolSearchParserTests.cs
index 0983b9ab22df..edc93e7f2001 100644
--- a/src/Tests/dotnet.Tests/ParserTests/ToolSearchParserTests.cs
+++ b/src/Tests/dotnet.Tests/ParserTests/ToolSearchParserTests.cs
@@ -35,14 +35,14 @@ public void ListSearchParserCanGetArguments()
{
var result = Parser.Instance.Parse("dotnet tool search mytool --detail --skip 3 --take 4 --prerelease");
- var packageId = result.GetValueForArgument(ToolSearchCommandParser.SearchTermArgument);
+ var packageId = result.GetValue(ToolSearchCommandParser.SearchTermArgument);
packageId.Should().Be("mytool");
result.UnmatchedTokens.Should().BeEmpty();
- result.GetValueForOption(ToolSearchCommandParser.DetailOption).Should().Be(true);
- result.GetValueForOption(ToolSearchCommandParser.SkipOption).Should().Be("3");
- result.GetValueForOption(ToolSearchCommandParser.TakeOption).Should().Be("4");
- result.GetValueForOption(ToolSearchCommandParser.PrereleaseOption).Should().Be(true);
+ result.GetValue(ToolSearchCommandParser.DetailOption).Should().Be(true);
+ result.GetValue(ToolSearchCommandParser.SkipOption).Should().Be("3");
+ result.GetValue(ToolSearchCommandParser.TakeOption).Should().Be("4");
+ result.GetValue(ToolSearchCommandParser.PrereleaseOption).Should().Be(true);
}
}
}
diff --git a/src/Tests/dotnet.Tests/ParserTests/UninstallToolParserTests.cs b/src/Tests/dotnet.Tests/ParserTests/UninstallToolParserTests.cs
index 7bfd9d0c6d9b..3f8d03663752 100644
--- a/src/Tests/dotnet.Tests/ParserTests/UninstallToolParserTests.cs
+++ b/src/Tests/dotnet.Tests/ParserTests/UninstallToolParserTests.cs
@@ -25,7 +25,7 @@ public void UninstallToolParserCanGetPackageId()
{
var result = Parser.Instance.Parse("dotnet tool uninstall -g console.test.app");
- var packageId = result.GetValueForArgument(ToolUninstallCommandParser.PackageIdArgument);
+ var packageId = result.GetValue(ToolUninstallCommandParser.PackageIdArgument);
packageId.Should().Be("console.test.app");
}
@@ -35,7 +35,7 @@ public void UninstallToolParserCanGetGlobalOption()
{
var result = Parser.Instance.Parse("dotnet tool uninstall -g console.test.app");
- result.GetValueForOption(ToolUninstallCommandParser.GlobalOption).Should().Be(true);
+ result.GetValue(ToolUninstallCommandParser.GlobalOption).Should().Be(true);
}
[Fact]
@@ -44,7 +44,7 @@ public void UninstallToolParserCanParseToolPathOption()
var result =
Parser.Instance.Parse(@"dotnet tool uninstall --tool-path C:\Tools console.test.app");
- result.GetValueForOption(ToolUninstallCommandParser.ToolPathOption).Should().Be(@"C:\Tools");
+ result.GetValue(ToolUninstallCommandParser.ToolPathOption).Should().Be(@"C:\Tools");
}
[Fact]
@@ -53,7 +53,7 @@ public void UninstallToolParserCanParseLocalOption()
var result =
Parser.Instance.Parse(@"dotnet tool uninstall --local console.test.app");
- result.GetValueForOption(ToolUninstallCommandParser.LocalOption).Should().Be(true);
+ result.GetValue(ToolUninstallCommandParser.LocalOption).Should().Be(true);
}
[Fact]
@@ -62,7 +62,7 @@ public void UninstallToolParserCanParseToolManifestOption()
var result =
Parser.Instance.Parse(@"dotnet tool uninstall --tool-manifest folder/my-manifest.format console.test.app");
- result.GetValueForOption(ToolUninstallCommandParser.ToolManifestOption).Should().Be(@"folder/my-manifest.format");
+ result.GetValue(ToolUninstallCommandParser.ToolManifestOption).Should().Be(@"folder/my-manifest.format");
}
}
}
diff --git a/src/Tests/dotnet.Tests/ParserTests/UpdateToolParserTests.cs b/src/Tests/dotnet.Tests/ParserTests/UpdateToolParserTests.cs
index b144ab7bd236..9f6fa2da7327 100644
--- a/src/Tests/dotnet.Tests/ParserTests/UpdateToolParserTests.cs
+++ b/src/Tests/dotnet.Tests/ParserTests/UpdateToolParserTests.cs
@@ -28,7 +28,7 @@ public void UpdateGlobaltoolParserCanGetPackageId()
{
var result = Parser.Instance.Parse("dotnet tool update -g console.test.app");
- var packageId = result.GetValueForArgument(ToolUpdateCommandParser.PackageIdArgument);
+ var packageId = result.GetValue(ToolUpdateCommandParser.PackageIdArgument);
packageId.Should().Be("console.test.app");
}
@@ -38,7 +38,7 @@ public void UpdateToolParserCanGetGlobalOption()
{
var result = Parser.Instance.Parse("dotnet tool update -g console.test.app");
- result.GetValueForOption(ToolUpdateCommandParser.GlobalOption).Should().Be(true);
+ result.GetValue(ToolUpdateCommandParser.GlobalOption).Should().Be(true);
}
[Fact]
@@ -48,8 +48,8 @@ public void UpdateToolParserCanGetFollowingArguments()
Parser.Instance.Parse(
$@"dotnet tool update -g console.test.app --version 1.0.1 --framework {ToolsetInfo.CurrentTargetFramework} --configfile C:\TestAssetLocalNugetFeed");
- result.GetValueForOption(ToolUpdateCommandParser.ConfigOption).Should().Be(@"C:\TestAssetLocalNugetFeed");
- result.GetValueForOption(ToolUpdateCommandParser.FrameworkOption).Should().Be(ToolsetInfo.CurrentTargetFramework);
+ result.GetValue(ToolUpdateCommandParser.ConfigOption).Should().Be(@"C:\TestAssetLocalNugetFeed");
+ result.GetValue(ToolUpdateCommandParser.FrameworkOption).Should().Be(ToolsetInfo.CurrentTargetFramework);
}
[Fact]
@@ -60,7 +60,7 @@ public void UpdateToolParserCanParseSourceOption()
var result =
Parser.Instance.Parse($"dotnet tool update -g --add-source {expectedSourceValue} console.test.app");
- result.GetValueForOption(ToolUpdateCommandParser.AddSourceOption).First().Should().Be(expectedSourceValue);
+ result.GetValue(ToolUpdateCommandParser.AddSourceOption).First().Should().Be(expectedSourceValue);
}
[Fact]
@@ -75,8 +75,8 @@ public void UpdateToolParserCanParseMultipleSourceOption()
$"--add-source {expectedSourceValue1} " +
$"--add-source {expectedSourceValue2} console.test.app");
- result.GetValueForOption(ToolUpdateCommandParser.AddSourceOption)[0].Should().Be(expectedSourceValue1);
- result.GetValueForOption(ToolUpdateCommandParser.AddSourceOption)[1].Should().Be(expectedSourceValue2);
+ result.GetValue(ToolUpdateCommandParser.AddSourceOption)[0].Should().Be(expectedSourceValue1);
+ result.GetValue(ToolUpdateCommandParser.AddSourceOption)[1].Should().Be(expectedSourceValue2);
}
[Fact]
@@ -87,7 +87,7 @@ public void UpdateToolParserCanParseVerbosityOption()
var result =
Parser.Instance.Parse($"dotnet tool update -g --verbosity:{expectedVerbosityLevel} console.test.app");
- Enum.GetName(result.GetValueForOption(ToolUpdateCommandParser.VerbosityOption)).Should().Be(expectedVerbosityLevel);
+ Enum.GetName(result.GetValue(ToolUpdateCommandParser.VerbosityOption)).Should().Be(expectedVerbosityLevel);
}
[Fact]
@@ -96,7 +96,7 @@ public void UpdateToolParserCanParseToolPathOption()
var result =
Parser.Instance.Parse(@"dotnet tool update --tool-path C:\TestAssetLocalNugetFeed console.test.app");
- result.GetValueForOption(ToolUpdateCommandParser.ToolPathOption).Should().Be(@"C:\TestAssetLocalNugetFeed");
+ result.GetValue(ToolUpdateCommandParser.ToolPathOption).Should().Be(@"C:\TestAssetLocalNugetFeed");
}
[Fact]
@@ -141,7 +141,7 @@ public void UpdateToolParserCanParseVersionOption()
var result =
Parser.Instance.Parse(@"dotnet tool update -g console.test.app --version 1.2");
- result.GetValueForOption(ToolUpdateCommandParser.VersionOption).Should().Be("1.2");
+ result.GetValue(ToolUpdateCommandParser.VersionOption).Should().Be("1.2");
}
[Fact]
@@ -150,7 +150,7 @@ public void UpdateToolParserCanParseLocalOption()
var result =
Parser.Instance.Parse(@"dotnet tool update --local console.test.app");
- result.GetValueForOption(ToolUpdateCommandParser.LocalOption).Should().Be(true);
+ result.GetValue(ToolUpdateCommandParser.LocalOption).Should().Be(true);
}
[Fact]
@@ -159,7 +159,7 @@ public void UpdateToolParserCanParseToolManifestOption()
var result =
Parser.Instance.Parse(@"dotnet tool update --tool-manifest folder/my-manifest.format console.test.app");
- result.GetValueForOption(ToolUpdateCommandParser.ToolManifestOption).Should().Be(@"folder/my-manifest.format");
+ result.GetValue(ToolUpdateCommandParser.ToolManifestOption).Should().Be(@"folder/my-manifest.format");
}
}
}