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
* avoid a string allocation and don't store the UnprefixedValue
* ensure Token is implementing IEquatable<Token> interface correctly
* make Token a struct to reduce managed memory allocations
* always print allocated memory in bytes (to avoid precision when they are rounded to kb)
* make ArgumentArity a struct
* don't create a copy of RootCommand symbols
* don't store an additional copy of aliases in AliasedSet
* optimize IsGreedy
* avoid casting performedd by ResetIndex if there is nothing to reset
* replace TryAdd (calls Contains and Add) with overriding
* delay Validators list allocaiton until we actually need it
* extend Token with Symbol to avoid mapping name to Symbol when parsing Commands and Options
remove WasBundled as it was not used anywhere
* remove Obsolete methods that were calling GetByAlias
* remove SymbolResultSet, just use List<SymbolResult> instead
remove AliasedSet, don't verify aliases at model creation time
remove ContainsAlias and GetByAlias as they are not needed since Token got extended with Symbol
* both Command and Option derive from IdentifierSymbol, so there is no need to duplicate the logic around aliases
* optimize DefaultName
* optimize unbundling
* don't try to add children commands more than once
* RootCommands should not be nested?
* don't copy all global options when creating CommandLineConfiguration
* implement Command.Validate to allow the users to validate their commands when they need to
* don't duplicate GlobalOptions, just treat them as special Options
* simplify the Parent hierarchy
* address code review feedback:
* make Matches internal
* make IsGlobal internal
* make SymbolResult.Children readonly
* add comment about complexity and perf
* move Command.Validate to CommandLineConfiguration, delete the tests for now
Copy file name to clipboardExpand all lines: src/System.CommandLine.ApiCompatibility.Tests/ApiCompatibilityApprovalTests.System_CommandLine_api_is_not_changed.approved.txt
+29-39Lines changed: 29 additions & 39 deletions
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
public class Argument : Symbol, System.CommandLine.Binding.IValueDescriptor, System.CommandLine.Completions.ICompletionSource, IArgument, ISymbol
3
3
.ctor()
4
4
.ctor(System.String name = null, System.String description = null)
public interface IArgument : System.CommandLine.Binding.IValueDescriptor, System.CommandLine.Completions.ICompletionSource, ISymbol
128
-
public IArgumentArity Arity { get; }
129
-
public interface IArgumentArity
130
-
public System.Int32 MaximumNumberOfValues { get; }
131
-
public System.Int32 MinimumNumberOfValues { get; }
129
+
public ArgumentArity Arity { get; }
132
130
public interface ICommand : System.CommandLine.Completions.ICompletionSource, IIdentifierSymbol, ISymbol
133
131
public System.Collections.Generic.IReadOnlyList<IArgument> Arguments { get; }
134
132
public System.Collections.Generic.IReadOnlyList<IOption> Options { get; }
@@ -137,6 +135,7 @@
137
135
public abstract class IdentifierSymbol : Symbol, System.CommandLine.Completions.ICompletionSource, IIdentifierSymbol, ISymbol
138
136
public System.Collections.Generic.IReadOnlyCollection<System.String> Aliases { get; }
139
137
public System.String Name { get; set; }
138
+
public System.Void AddAlias(System.String alias)
140
139
public System.Boolean HasAlias(System.String alias)
141
140
public interface IDirectiveCollection : System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<System.String,System.Collections.Generic.IEnumerable<System.String>>>, System.Collections.IEnumerable
142
141
public System.Boolean Contains(System.String name)
@@ -149,11 +148,11 @@
149
148
public IArgument Argument { get; }
150
149
public System.Boolean IsRequired { get; }
151
150
public interface ISymbol : System.CommandLine.Completions.ICompletionSource
152
-
public System.CommandLine.Collections.ISymbolSet Children { get; }
151
+
public System.CommandLine.Collections.SymbolSet Children { get; }
153
152
public System.String Description { get; }
154
153
public System.Boolean IsHidden { get; }
155
154
public System.String Name { get; }
156
-
public System.CommandLine.Collections.ISymbolSet Parents { get; }
155
+
public System.Collections.Generic.IEnumerable<Symbol> Parents { get; }
157
156
public class LocalizationResources
158
157
public static LocalizationResources Instance { get; }
159
158
public System.String ArgumentConversionCannotParse(System.String value, System.Type expectedType)
@@ -195,14 +194,13 @@
195
194
public System.String VersionOptionCannotBeCombinedWithOtherArguments(System.String optionAlias)
196
195
public System.String VersionOptionDescription()
197
196
public class Option : IdentifierSymbol, System.CommandLine.Binding.IValueDescriptor, System.CommandLine.Completions.ICompletionSource, IIdentifierSymbol, IOption, ISymbol
public static TOption AddCompletions<TOption>(this TOption option, System.String[] values)
220
218
public static TOption AddCompletions<TOption>(this TOption option, System.Func<System.CommandLine.Completions.CompletionContext,System.Collections.Generic.IEnumerable<System.String>> complete)
@@ -237,7 +235,7 @@
237
235
public System.String Description { get; set; }
238
236
public System.Boolean IsHidden { get; set; }
239
237
public System.String Name { get; set; }
240
-
public System.CommandLine.Collections.ISymbolSet Parents { get; }
238
+
public System.Collections.Generic.IEnumerable<Symbol> Parents { get; }
241
239
public System.Collections.Generic.IEnumerable<System.CommandLine.Completions.CompletionItem> GetCompletions()
242
240
public System.Collections.Generic.IEnumerable<System.CommandLine.Completions.CompletionItem> GetCompletions(System.CommandLine.Completions.CompletionContext context)
243
241
public System.String ToString()
@@ -302,18 +300,11 @@ System.CommandLine.Builder
302
300
public static CommandLineBuilder UseVersionOption(this CommandLineBuilder builder)
303
301
public static CommandLineBuilder UseVersionOption(this CommandLineBuilder builder, System.String[] aliases)
304
302
System.CommandLine.Collections
305
-
public abstract class AliasedSet<T>, IReadOnlyList<T>, IReadOnlyCollection<T>, IEnumerable<T>, System.Collections.IEnumerable
306
-
public System.Int32 Count { get; }
307
-
public T Item { get; }
308
-
public System.Boolean ContainsAlias(System.String alias)
public interface ISymbolSet : System.Collections.Generic.IEnumerable<System.CommandLine.ISymbol>, System.Collections.Generic.IReadOnlyCollection<System.CommandLine.ISymbol>, System.Collections.Generic.IReadOnlyList<System.CommandLine.ISymbol>, System.Collections.IEnumerable
313
-
public System.CommandLine.ISymbol GetByAlias(System.String alias)
314
-
public class SymbolSet : AliasedSet<System.CommandLine.ISymbol>, System.Collections.Generic.IEnumerable<System.CommandLine.ISymbol>, System.Collections.Generic.IReadOnlyCollection<System.CommandLine.ISymbol>, System.Collections.Generic.IReadOnlyList<System.CommandLine.ISymbol>, System.Collections.IEnumerable, ISymbolSet
303
+
public class SymbolSet, System.Collections.Generic.IEnumerable<System.CommandLine.Symbol>, System.Collections.IEnumerable
public System.Collections.Generic.IEnumerator<System.CommandLine.Symbol> GetEnumerator()
317
308
System.CommandLine.Completions
318
309
public abstract class CompletionContext
319
310
public System.CommandLine.Parsing.ParseResult ParseResult { get; }
@@ -528,7 +519,7 @@ System.CommandLine.Parsing
528
519
ParseArgsAsSpaceSeparated=1
529
520
Disabled=2
530
521
public abstract class SymbolResult
531
-
public SymbolResultSet Children { get; }
522
+
public System.Collections.Generic.IReadOnlyList<SymbolResult> Children { get; }
532
523
public System.String ErrorMessage { get; set; }
533
524
public System.CommandLine.LocalizationResources LocalizationResources { get; set; }
534
525
public SymbolResult Parent { get; }
@@ -538,16 +529,15 @@ System.CommandLine.Parsing
538
529
public CommandResult FindResultFor(System.CommandLine.ICommand command)
539
530
public OptionResult FindResultFor(System.CommandLine.IOption option)
540
531
public System.String ToString()
541
-
public class SymbolResultSet : System.CommandLine.Collections.AliasedSet<SymbolResult>, System.Collections.Generic.IEnumerable<SymbolResult>, System.Collections.Generic.IReadOnlyCollection<SymbolResult>, System.Collections.Generic.IReadOnlyList<SymbolResult>, System.Collections.IEnumerable
0 commit comments