You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Separate CliAction into synchronous and asynchronous types (#2205)
* split CliAction into sync and async types
* minor cleanups
* Move typo corrections into ParseErrorAction, make it public
This also adds properties to the ParseErrorAction to allow toggling help and typo suggestions when there's a parse error.
* rename test class
* bring back (internal) anonymous CliAction types
* generalize precedence of directive actions over option actions
* split into separate files, add XML doc comments
* rename DiagramAction to ParseDiagramAction
* split CompletionAction into a separate file
* exclude benchmarks project from .sln
* Address PR comments
* support non-terminating option actions
* reuse IsBoolean() method
* update API baseline
Copy file name to clipboardExpand all lines: src/System.CommandLine.ApiCompatibility.Tests/ApiCompatibilityApprovalTests.System_CommandLine_NamingConventionBinder_api_is_not_changed.approved.txt
Copy file name to clipboardExpand all lines: src/System.CommandLine.ApiCompatibility.Tests/ApiCompatibilityApprovalTests.System_CommandLine_api_is_not_changed.approved.txt
+26-19Lines changed: 26 additions & 19 deletions
Original file line number
Diff line number
Diff line change
@@ -16,11 +16,6 @@ System.CommandLine
16
16
public static CliArgument<System.IO.DirectoryInfo> AcceptExistingOnly(this CliArgument<System.IO.DirectoryInfo> argument)
17
17
public static CliArgument<System.IO.FileSystemInfo> AcceptExistingOnly(this CliArgument<System.IO.FileSystemInfo> argument)
18
18
public static CliArgument<T> AcceptExistingOnly<T>(this CliArgument<T> argument)
19
-
public abstract class CliAction
20
-
public System.Boolean Exclusive { get; }
21
-
public System.Int32 Invoke(ParseResult parseResult)
22
-
public System.Threading.Tasks.Task<System.Int32> InvokeAsync(ParseResult parseResult, System.Threading.CancellationToken cancellationToken = null)
public System.CommandLine.Invocation.CliAction Action { get; set; }
46
41
public System.Collections.Generic.ICollection<System.String> Aliases { get; }
47
42
public System.Collections.Generic.IList<CliArgument> Arguments { get; }
48
43
public System.Collections.Generic.IEnumerable<CliSymbol> Children { get; }
49
44
public System.Collections.Generic.IList<CliOption> Options { get; }
50
45
public System.Collections.Generic.IList<CliCommand> Subcommands { get; }
51
46
public System.Boolean TreatUnmatchedTokensAsErrors { get; set; }
52
47
public System.Collections.Generic.List<System.Action<System.CommandLine.Parsing.CommandResult>> Validators { get; }
53
-
public System.Void Add(CliSymbol symbol)
48
+
public System.Void Add(CliArgument argument)
49
+
public System.Void Add(CliOption option)
50
+
public System.Void Add(CliCommand command)
54
51
public System.Collections.Generic.IEnumerable<System.CommandLine.Completions.CompletionItem> GetCompletions(System.CommandLine.Completions.CompletionContext context)
55
52
public System.Collections.Generic.IEnumerator<CliSymbol> GetEnumerator()
56
53
public ParseResult Parse(System.Collections.Generic.IReadOnlyList<System.String> args, CliConfiguration configuration = null)
@@ -63,9 +60,7 @@ System.CommandLine
63
60
.ctor(CliCommand rootCommand)
64
61
public System.Collections.Generic.List<CliDirective> Directives { get; }
65
62
public System.Boolean EnableDefaultExceptionHandler { get; set; }
66
-
public System.Boolean EnableParseErrorReporting { get; set; }
67
63
public System.Boolean EnablePosixBundling { get; set; }
68
-
public System.Boolean EnableTypoCorrections { get; set; }
69
64
public System.IO.TextWriter Error { get; set; }
70
65
public System.IO.TextWriter Output { get; set; }
71
66
public System.Nullable<System.TimeSpan> ProcessTerminationTimeout { get; set; }
@@ -82,10 +77,10 @@ System.CommandLine
82
77
.ctor(System.String message)
83
78
public class CliDirective : CliSymbol
84
79
.ctor(System.String name)
85
-
public CliAction Action { get; set; }
80
+
public System.CommandLine.Invocation.CliAction Action { get; set; }
86
81
public System.Collections.Generic.IEnumerable<System.CommandLine.Completions.CompletionItem> GetCompletions(System.CommandLine.Completions.CompletionContext context)
87
82
public abstract class CliOption : CliSymbol
88
-
public CliAction Action { get; set; }
83
+
public System.CommandLine.Invocation.CliAction Action { get; set; }
89
84
public System.Collections.Generic.ICollection<System.String> Aliases { get; }
90
85
public System.Boolean AllowMultipleArgumentsPerToken { get; set; }
91
86
public ArgumentArity Arity { get; set; }
@@ -120,18 +115,18 @@ System.CommandLine
120
115
public static System.Void Add(this System.Collections.Generic.List<System.Func<System.CommandLine.Completions.CompletionContext,System.Collections.Generic.IEnumerable<System.CommandLine.Completions.CompletionItem>>> completionSources, System.String[] completions)
121
116
public class DiagramDirective : CliDirective
122
117
.ctor()
123
-
public CliAction Action { get; set; }
118
+
public System.CommandLine.Invocation.CliAction Action { get; set; }
124
119
public System.Int32 ParseErrorReturnValue { get; set; }
125
120
public class EnvironmentVariablesDirective : CliDirective
126
121
.ctor()
127
-
public CliAction Action { get; set; }
122
+
public System.CommandLine.Invocation.CliAction Action { get; set; }
128
123
public static class OptionValidation
129
124
public static CliOption<System.IO.FileInfo> AcceptExistingOnly(this CliOption<System.IO.FileInfo> option)
130
125
public static CliOption<System.IO.DirectoryInfo> AcceptExistingOnly(this CliOption<System.IO.DirectoryInfo> option)
131
126
public static CliOption<System.IO.FileSystemInfo> AcceptExistingOnly(this CliOption<System.IO.FileSystemInfo> option)
132
127
public static CliOption<T> AcceptExistingOnly<T>(this CliOption<T> option)
133
128
public class ParseResult
134
-
public CliAction Action { get; }
129
+
public System.CommandLine.Invocation.CliAction Action { get; }
135
130
public System.CommandLine.Parsing.CommandResult CommandResult { get; }
136
131
public CliConfiguration Configuration { get; }
137
132
public System.Collections.Generic.IReadOnlyList<System.CommandLine.Parsing.ParseError> Errors { get; }
@@ -154,7 +149,7 @@ System.CommandLine
154
149
public class VersionOption : CliOption<System.Boolean>
0 commit comments