diff --git a/samples/RenderingPlayground/Program.cs b/samples/RenderingPlayground/Program.cs
index d22a52b788..8dbc429a87 100644
--- a/samples/RenderingPlayground/Program.cs
+++ b/samples/RenderingPlayground/Program.cs
@@ -2,7 +2,7 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
-using System.CommandLine.Invocation;
+using System.CommandLine;
using System.CommandLine.IO;
using System.CommandLine.Rendering;
using System.CommandLine.Rendering.Views;
@@ -18,7 +18,7 @@ class Program
///
/// Demonstrates various rendering capabilities.
///
- ///
+ ///
/// Renders a specified sample
/// The height of the rendering area
/// The width of the rendering area
@@ -28,7 +28,7 @@ class Program
/// Overwrite the specified region. (If not, scroll.)
public static void Main(
#pragma warning disable CS1573 // Parameter has no matching param tag in the XML comment (but other parameters do)
- InvocationContext invocationContext,
+ ParseResult parseResult,
SampleName sample = SampleName.Dir,
int? height = null,
int? width = null,
diff --git a/src/System.CommandLine.ApiCompatibility.Tests/ApiCompatibilityApprovalTests.System_CommandLine_Hosting_api_is_not_changed.approved.txt b/src/System.CommandLine.ApiCompatibility.Tests/ApiCompatibilityApprovalTests.System_CommandLine_Hosting_api_is_not_changed.approved.txt
index b6fc1b7f1a..d419f8902a 100644
--- a/src/System.CommandLine.ApiCompatibility.Tests/ApiCompatibilityApprovalTests.System_CommandLine_Hosting_api_is_not_changed.approved.txt
+++ b/src/System.CommandLine.ApiCompatibility.Tests/ApiCompatibilityApprovalTests.System_CommandLine_Hosting_api_is_not_changed.approved.txt
@@ -3,13 +3,13 @@ System.CommandLine.Hosting
public static Microsoft.Extensions.Configuration.IConfigurationBuilder AddCommandLineDirectives(this Microsoft.Extensions.Configuration.IConfigurationBuilder config, System.CommandLine.ParseResult commandline, System.CommandLine.Directive directive)
public static class HostingExtensions
public static OptionsBuilder BindCommandLine(this OptionsBuilder optionsBuilder)
- public static Microsoft.Extensions.Hosting.IHost GetHost(this System.CommandLine.Invocation.InvocationContext invocationContext)
- public static System.CommandLine.Invocation.InvocationContext GetInvocationContext(this Microsoft.Extensions.Hosting.IHostBuilder hostBuilder)
- public static System.CommandLine.Invocation.InvocationContext GetInvocationContext(this Microsoft.Extensions.Hosting.HostBuilderContext context)
+ public static Microsoft.Extensions.Hosting.IHost GetHost(this System.CommandLine.ParseResult parseResult)
+ public static System.CommandLine.ParseResult GetParseResult(this Microsoft.Extensions.Hosting.IHostBuilder hostBuilder)
+ public static System.CommandLine.ParseResult GetParseResult(this Microsoft.Extensions.Hosting.HostBuilderContext context)
public static System.CommandLine.Command UseCommandHandler(this System.CommandLine.Command command)
public static System.CommandLine.CommandLineConfiguration UseHost(this System.CommandLine.CommandLineConfiguration builder, System.Action configureHost = null)
public static System.CommandLine.CommandLineConfiguration UseHost(this System.CommandLine.CommandLineConfiguration builder, System.Func hostBuilderFactory, System.Action configureHost = null)
- public static Microsoft.Extensions.Hosting.IHostBuilder UseInvocationLifetime(this Microsoft.Extensions.Hosting.IHostBuilder host, System.CommandLine.Invocation.InvocationContext invocation, System.Action configureOptions = null)
+ public static Microsoft.Extensions.Hosting.IHostBuilder UseInvocationLifetime(this Microsoft.Extensions.Hosting.IHostBuilder host, System.Action configureOptions = null)
public class InvocationLifetime, Microsoft.Extensions.Hosting.IHostLifetime
.ctor(Microsoft.Extensions.Options.IOptions options, Microsoft.Extensions.Hosting.IHostEnvironment environment, Microsoft.Extensions.Hosting.IHostApplicationLifetime applicationLifetime, Microsoft.Extensions.Logging.ILoggerFactory loggerFactory = null)
public Microsoft.Extensions.Hosting.IHostApplicationLifetime ApplicationLifetime { get; }
diff --git a/src/System.CommandLine.ApiCompatibility.Tests/ApiCompatibilityApprovalTests.System_CommandLine_NamingConventionBinder_api_is_not_changed.approved.txt b/src/System.CommandLine.ApiCompatibility.Tests/ApiCompatibilityApprovalTests.System_CommandLine_NamingConventionBinder_api_is_not_changed.approved.txt
index 3967f7057a..acf1436179 100644
--- a/src/System.CommandLine.ApiCompatibility.Tests/ApiCompatibilityApprovalTests.System_CommandLine_NamingConventionBinder_api_is_not_changed.approved.txt
+++ b/src/System.CommandLine.ApiCompatibility.Tests/ApiCompatibilityApprovalTests.System_CommandLine_NamingConventionBinder_api_is_not_changed.approved.txt
@@ -14,10 +14,10 @@
System.CommandLine.NamingConventionBinder
public static class BindingContextExtensions
public static System.Void AddModelBinder(this System.CommandLine.Binding.BindingContext bindingContext, ModelBinder binder)
- public static System.CommandLine.Binding.BindingContext GetBindingContext(this System.CommandLine.Invocation.InvocationContext ctx)
+ public static System.CommandLine.Binding.BindingContext GetBindingContext(this System.CommandLine.ParseResult parseResult)
public static ModelBinder GetOrCreateModelBinder(this System.CommandLine.Binding.BindingContext bindingContext, System.CommandLine.Binding.IValueDescriptor valueDescriptor)
public abstract class BindingHandler : System.CommandLine.CliAction
- public System.CommandLine.Binding.BindingContext GetBindingContext(System.CommandLine.Invocation.InvocationContext invocationContext)
+ public System.CommandLine.Binding.BindingContext GetBindingContext(System.CommandLine.ParseResult parseResult)
public static class CommandHandler
public static BindingHandler Create(System.Delegate delegate)
public static BindingHandler Create(Action action)
@@ -114,8 +114,8 @@ System.CommandLine.NamingConventionBinder
public class ModelBindingCommandHandler : BindingHandler
public System.Void BindParameter(System.Reflection.ParameterInfo param, System.CommandLine.Argument argument)
public System.Void BindParameter(System.Reflection.ParameterInfo param, System.CommandLine.Option option)
- public System.Int32 Invoke(System.CommandLine.Invocation.InvocationContext context)
- public System.Threading.Tasks.Task InvokeAsync(System.CommandLine.Invocation.InvocationContext context, System.Threading.CancellationToken cancellationToken = null)
+ public System.Int32 Invoke(System.CommandLine.ParseResult parseResult)
+ public System.Threading.Tasks.Task InvokeAsync(System.CommandLine.ParseResult parseResult, System.Threading.CancellationToken cancellationToken = null)
public class ModelDescriptor
public static ModelDescriptor FromType()
public static ModelDescriptor FromType(System.Type type)
diff --git a/src/System.CommandLine.ApiCompatibility.Tests/ApiCompatibilityApprovalTests.System_CommandLine_api_is_not_changed.approved.txt b/src/System.CommandLine.ApiCompatibility.Tests/ApiCompatibilityApprovalTests.System_CommandLine_api_is_not_changed.approved.txt
index 3345630a3b..f3df3f29d7 100644
--- a/src/System.CommandLine.ApiCompatibility.Tests/ApiCompatibilityApprovalTests.System_CommandLine_api_is_not_changed.approved.txt
+++ b/src/System.CommandLine.ApiCompatibility.Tests/ApiCompatibilityApprovalTests.System_CommandLine_api_is_not_changed.approved.txt
@@ -36,8 +36,8 @@ System.CommandLine
public static Argument AcceptExistingOnly(this Argument argument)
public static Argument AcceptExistingOnly(this Argument argument)
public abstract class CliAction
- public System.Int32 Invoke(System.CommandLine.Invocation.InvocationContext context)
- public System.Threading.Tasks.Task InvokeAsync(System.CommandLine.Invocation.InvocationContext context, System.Threading.CancellationToken cancellationToken = null)
+ public System.Int32 Invoke(ParseResult parseResult)
+ public System.Threading.Tasks.Task InvokeAsync(ParseResult parseResult, System.Threading.CancellationToken cancellationToken = null)
public class Command : Symbol, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable
.ctor(System.String name, System.String description = null)
public CliAction Action { get; set; }
@@ -53,10 +53,10 @@ System.CommandLine
public System.Collections.Generic.IEnumerator GetEnumerator()
public ParseResult Parse(System.Collections.Generic.IReadOnlyList args, CommandLineConfiguration configuration = null)
public ParseResult Parse(System.String commandLine, CommandLineConfiguration configuration = null)
- public System.Void SetAction(System.Action action)
- public System.Void SetAction(System.Func action)
- public System.Void SetAction(System.Func action)
- public System.Void SetAction(System.Func> action)
+ public System.Void SetAction(System.Action action)
+ public System.Void SetAction(System.Func action)
+ public System.Void SetAction(System.Func action)
+ public System.Void SetAction(System.Func> action)
public class CommandLineConfiguration
.ctor(Command rootCommand)
public System.Collections.Generic.List Directives { get; }
@@ -190,8 +190,8 @@ System.CommandLine.Help
public class HelpAction : System.CommandLine.CliAction
.ctor()
public HelpBuilder Builder { get; set; }
- public System.Int32 Invoke(System.CommandLine.Invocation.InvocationContext context)
- public System.Threading.Tasks.Task InvokeAsync(System.CommandLine.Invocation.InvocationContext context, System.Threading.CancellationToken cancellationToken = null)
+ public System.Int32 Invoke(System.CommandLine.ParseResult parseResult)
+ public System.Threading.Tasks.Task InvokeAsync(System.CommandLine.ParseResult parseResult, System.Threading.CancellationToken cancellationToken = null)
public class HelpBuilder
.ctor(System.Int32 maxWidth = 2147483647)
public System.Int32 MaxWidth { get; }
@@ -235,12 +235,6 @@ System.CommandLine.Help
public System.Boolean Equals(System.Object obj)
public System.Boolean Equals(TwoColumnHelpRow other)
public System.Int32 GetHashCode()
-System.CommandLine.Invocation
- public class InvocationContext
- .ctor(System.CommandLine.ParseResult parseResult)
- public System.CommandLine.ParseResult ParseResult { get; set; }
- public T GetValue(Option option)
- public T GetValue(Argument argument)
System.CommandLine.Parsing
public class ArgumentResult : SymbolResult
public System.CommandLine.Argument Argument { get; }
diff --git a/src/System.CommandLine.Benchmarks/CommandLine/Perf_Parser_Simple.cs b/src/System.CommandLine.Benchmarks/CommandLine/Perf_Parser_Simple.cs
index f8ccc1a091..949e59933a 100644
--- a/src/System.CommandLine.Benchmarks/CommandLine/Perf_Parser_Simple.cs
+++ b/src/System.CommandLine.Benchmarks/CommandLine/Perf_Parser_Simple.cs
@@ -32,10 +32,10 @@ private static RootCommand BuildCommand()
stringOption
};
- command.SetAction(ctx =>
+ command.SetAction(parseResult =>
{
- bool boolean = ctx.ParseResult.GetValue(boolOption);
- string text = ctx.ParseResult.GetValue(stringOption);
+ bool boolean = parseResult.GetValue(boolOption);
+ string text = parseResult.GetValue(stringOption);
});
return command;
diff --git a/src/System.CommandLine.Benchmarks/DragonFruit/Perf_CommandLine_Help.cs b/src/System.CommandLine.Benchmarks/DragonFruit/Perf_CommandLine_Help.cs
index 0ae076af5d..0723941cd5 100644
--- a/src/System.CommandLine.Benchmarks/DragonFruit/Perf_CommandLine_Help.cs
+++ b/src/System.CommandLine.Benchmarks/DragonFruit/Perf_CommandLine_Help.cs
@@ -30,7 +30,7 @@ public void Setup()
{
typeof(object).GetTypeInfo().Assembly.Location,
typeof(Enumerable).GetTypeInfo().Assembly.Location,
- typeof(System.CommandLine.Invocation.InvocationContext).GetTypeInfo().Assembly.Location
+ typeof(System.CommandLine.ParseResult).GetTypeInfo().Assembly.Location
}
);
_testAssembly = Assembly.Load(File.ReadAllBytes(_testAssemblyFilePath));
diff --git a/src/System.CommandLine.Benchmarks/DragonFruit/Perf_XmlDocReader.cs b/src/System.CommandLine.Benchmarks/DragonFruit/Perf_XmlDocReader.cs
index 9bdfaa0f16..ffcd65615c 100644
--- a/src/System.CommandLine.Benchmarks/DragonFruit/Perf_XmlDocReader.cs
+++ b/src/System.CommandLine.Benchmarks/DragonFruit/Perf_XmlDocReader.cs
@@ -31,7 +31,7 @@ public Perf_XmlDocReader()
{
typeof(object).GetTypeInfo().Assembly.Location,
typeof(Enumerable).GetTypeInfo().Assembly.Location,
- typeof(System.CommandLine.Invocation.InvocationContext).GetTypeInfo().Assembly.Location
+ typeof(ParseResult).GetTypeInfo().Assembly.Location
}
);
diff --git a/src/System.CommandLine.Benchmarks/Input/Sample1.Main.cs b/src/System.CommandLine.Benchmarks/Input/Sample1.Main.cs
index c0a72bfb89..2fcfad415e 100644
--- a/src/System.CommandLine.Benchmarks/Input/Sample1.Main.cs
+++ b/src/System.CommandLine.Benchmarks/Input/Sample1.Main.cs
@@ -28,7 +28,7 @@ class Program
/// Overwrite the specified region. (If not, scroll.)
public static void Main(
#pragma warning disable CS1573 // Parameter has no matching param tag in the XML comment (but other parameters do)
- InvocationContext invocationContext,
+ ParseResult parseResult,
SampleName sample = SampleName.Dir,
int? height = null,
int? width = null,
diff --git a/src/System.CommandLine.DragonFruit.Tests/CommandLineTests.cs b/src/System.CommandLine.DragonFruit.Tests/CommandLineTests.cs
index d49bd990b4..a2c1799c21 100644
--- a/src/System.CommandLine.DragonFruit.Tests/CommandLineTests.cs
+++ b/src/System.CommandLine.DragonFruit.Tests/CommandLineTests.cs
@@ -1,7 +1,6 @@
// Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
-using System.CommandLine.Rendering;
using System.IO;
using System.Threading.Tasks;
using FluentAssertions;
diff --git a/src/System.CommandLine.DragonFruit.Tests/ConfigureFromMethodTests.cs b/src/System.CommandLine.DragonFruit.Tests/ConfigureFromMethodTests.cs
index 0e8cb5b840..d976a05e18 100644
--- a/src/System.CommandLine.DragonFruit.Tests/ConfigureFromMethodTests.cs
+++ b/src/System.CommandLine.DragonFruit.Tests/ConfigureFromMethodTests.cs
@@ -2,7 +2,6 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System.CommandLine.Binding;
-using System.CommandLine.Invocation;
using System.CommandLine.Tests.Binding;
using System.CommandLine.Tests.Utility;
using System.IO;
@@ -198,7 +197,6 @@ public async Task When_method_returns_Task_of_int_then_return_code_is_set_to_ret
}
[Theory]
- [InlineData(typeof(InvocationContext))]
[InlineData(typeof(BindingContext))]
[InlineData(typeof(ParseResult))]
[InlineData(typeof(CancellationToken))]
diff --git a/src/System.CommandLine.DragonFruit/CommandLine.cs b/src/System.CommandLine.DragonFruit/CommandLine.cs
index 78bb929397..01387118e8 100644
--- a/src/System.CommandLine.DragonFruit/CommandLine.cs
+++ b/src/System.CommandLine.DragonFruit/CommandLine.cs
@@ -3,8 +3,6 @@
using System.Collections.Generic;
using System.CommandLine.Binding;
-using System.CommandLine.Help;
-using System.CommandLine.Invocation;
using System.CommandLine.NamingConventionBinder;
using System.CommandLine.Utility;
using System.IO;
@@ -251,7 +249,6 @@ public static IEnumerable