Skip to content

Commit a045dd5

Browse files
authored
Name based lookup fixes (#2255)
* fix parent lookups for GetValue(string), add GetResult(string) * remove dead code and other cleanups * split out CustomParsingTests * make CliCommand IEnumerable, not IEnumerable<T> * remove EditorBrowsable(Never) from CliCommand.Add overloads * add custom parsing tests to cover SymbolResult.GetResult by name
1 parent 67df30a commit a045dd5

22 files changed

+1256
-1106
lines changed

src/System.CommandLine.ApiCompatibility.Tests/ApiCompatibilityApprovalTests.System_CommandLine_api_is_not_changed.approved.txt

+4-5
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ System.CommandLine
3535
public System.Void AcceptLegalFileNamesOnly()
3636
public System.Void AcceptLegalFilePathsOnly()
3737
public System.Void AcceptOnlyFromAmong(System.String[] values)
38-
public class CliCommand : CliSymbol, System.Collections.Generic.IEnumerable<CliSymbol>, System.Collections.IEnumerable
38+
public class CliCommand : CliSymbol, System.Collections.IEnumerable
3939
.ctor(System.String name, System.String description = null)
4040
public System.CommandLine.Invocation.CliAction Action { get; set; }
4141
public System.Collections.Generic.ICollection<System.String> Aliases { get; }
@@ -49,7 +49,6 @@ System.CommandLine
4949
public System.Void Add(CliOption option)
5050
public System.Void Add(CliCommand command)
5151
public System.Collections.Generic.IEnumerable<System.CommandLine.Completions.CompletionItem> GetCompletions(System.CommandLine.Completions.CompletionContext context)
52-
public System.Collections.Generic.IEnumerator<CliSymbol> GetEnumerator()
5352
public ParseResult Parse(System.Collections.Generic.IReadOnlyList<System.String> args, CliConfiguration configuration = null)
5453
public ParseResult Parse(System.String commandLine, CliConfiguration configuration = null)
5554
public System.Void SetAction(System.Action<ParseResult> action)
@@ -89,17 +88,15 @@ System.CommandLine
8988
public System.Boolean Recursive { get; set; }
9089
public System.Boolean Required { get; set; }
9190
public System.Collections.Generic.List<System.Action<System.CommandLine.Parsing.OptionResult>> Validators { get; }
92-
public System.Type ValueType { get; }
9391
public System.Collections.Generic.IEnumerable<System.CommandLine.Completions.CompletionItem> GetCompletions(System.CommandLine.Completions.CompletionContext context)
9492
public class CliOption<T> : CliOption
9593
.ctor(System.String name, System.String[] aliases)
9694
public Func<System.CommandLine.Parsing.ArgumentResult,T> CustomParser { get; set; }
9795
public Func<System.CommandLine.Parsing.ArgumentResult,T> DefaultValueFactory { get; set; }
98-
public System.Type ValueType { get; }
9996
public System.Void AcceptLegalFileNamesOnly()
10097
public System.Void AcceptLegalFilePathsOnly()
10198
public System.Void AcceptOnlyFromAmong(System.String[] values)
102-
public class CliRootCommand : CliCommand, System.Collections.Generic.IEnumerable<CliSymbol>, System.Collections.IEnumerable
99+
public class CliRootCommand : CliCommand, System.Collections.IEnumerable
103100
public static System.String ExecutableName { get; }
104101
public static System.String ExecutablePath { get; }
105102
.ctor(System.String description = )
@@ -290,8 +287,10 @@ System.CommandLine.Parsing
290287
public CommandResult GetResult(System.CommandLine.CliCommand command)
291288
public OptionResult GetResult(System.CommandLine.CliOption option)
292289
public DirectiveResult GetResult(System.CommandLine.CliDirective directive)
290+
public SymbolResult GetResult(System.String name)
293291
public T GetValue<T>(CliArgument<T> argument)
294292
public T GetValue<T>(CliOption<T> option)
293+
public T GetValue<T>(System.String name)
295294
public delegate TryReplaceToken : System.MulticastDelegate, System.ICloneable, System.Runtime.Serialization.ISerializable
296295
.ctor(System.Object object, System.IntPtr method)
297296
public System.IAsyncResult BeginInvoke(System.String tokenToReplace, ref System.Collections.Generic.IReadOnlyList<System.String> replacementTokens, ref System.String& errorMessage, System.AsyncCallback callback, System.Object object)

0 commit comments

Comments
 (0)