From f5e963ff6521628ec05fa7755580d2d64d468c15 Mon Sep 17 00:00:00 2001 From: Tom Dykstra Date: Tue, 5 Apr 2022 12:25:45 -0700 Subject: [PATCH 1/3] Apply comments from #7859 --- .../Builder/CommandLineBuilderExtensions.cs | 7 ++++--- src/System.CommandLine/IdentifierSymbol.cs | 9 ++++++--- src/System.CommandLine/Parsing/Parser.cs | 6 +++--- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/System.CommandLine/Builder/CommandLineBuilderExtensions.cs b/src/System.CommandLine/Builder/CommandLineBuilderExtensions.cs index 1b2183da91..785957c4f5 100644 --- a/src/System.CommandLine/Builder/CommandLineBuilderExtensions.cs +++ b/src/System.CommandLine/Builder/CommandLineBuilderExtensions.cs @@ -100,8 +100,9 @@ public static CommandLineBuilder CancelOnProcessTermination(this CommandLineBuil /// Enables the parser to recognize command line directives. /// /// A command line builder. - /// If set to , then directives are enabled. Otherwise, they are parsed like any other token. + /// to enable directives. to parse directive-like tokens in the same way as any other token. /// The same instance of . + /// Command-line directives /// public static CommandLineBuilder EnableDirectives( this CommandLineBuilder builder, @@ -114,7 +115,7 @@ public static CommandLineBuilder EnableDirectives( /// /// Determines the behavior when parsing a double dash (--) in a command line. /// - /// When set to , all tokens following -- will be placed into the collection. When set to , all tokens following -- will be treated as command arguments, even if they match an existing option. + /// to place all tokens following -- into the collection. to treat all tokens following -- as command arguments, even if they match an existing option. public static CommandLineBuilder EnableLegacyDoubleDashBehavior( this CommandLineBuilder builder, bool value = true) @@ -127,7 +128,7 @@ public static CommandLineBuilder EnableLegacyDoubleDashBehavior( /// Enables the parser to recognize and expand POSIX-style bundled options. /// /// A command line builder. - /// If set to , then POSIX bundles are parsed. ; otherwise, . + /// to parse POSIX bundles; otherwise, . /// The same instance of . /// /// POSIX conventions recommend that single-character options be allowed to be specified together after a single - prefix. When is set to , the following command lines are equivalent: diff --git a/src/System.CommandLine/IdentifierSymbol.cs b/src/System.CommandLine/IdentifierSymbol.cs index 92b49598a2..95e16e92fe 100644 --- a/src/System.CommandLine/IdentifierSymbol.cs +++ b/src/System.CommandLine/IdentifierSymbol.cs @@ -60,9 +60,12 @@ public override string Name } /// - /// Adds an alias. Multiple aliases can be added, most often used to provide a shorthand alternative. + /// Adds an alias. /// /// The alias to add. + /// + /// You can add multiple aliases for a symbol. + /// public void AddAlias(string alias) { ThrowIfAliasIsInvalid(alias); @@ -73,10 +76,10 @@ public void AddAlias(string alias) private protected virtual void RemoveAlias(string alias) => _aliases.Remove(alias); /// - /// Determines whether the alias has already been defined. + /// Determines whether the specified alias has already been defined. /// /// The alias to search for. - /// true if the alias has already been defined; otherwise false. + /// if the alias has already been defined; otherwise . public bool HasAlias(string alias) => _aliases.Contains(alias); [DebuggerStepThrough] diff --git a/src/System.CommandLine/Parsing/Parser.cs b/src/System.CommandLine/Parsing/Parser.cs index 74262e8e62..b2591fc192 100644 --- a/src/System.CommandLine/Parsing/Parser.cs +++ b/src/System.CommandLine/Parsing/Parser.cs @@ -23,14 +23,14 @@ public Parser(Command command) : this(new CommandLineConfiguration(command)) } /// - /// Initializes a new instance of the Parser class with using the default . + /// Initializes a new instance of the class using the default . /// public Parser() : this(new RootCommand()) { } /// - /// The configuration on which the parser's grammar and behaviors are based. + /// Gets the configuration on which the parser's grammar and behaviors are based. /// public CommandLineConfiguration Configuration { get; } @@ -38,7 +38,7 @@ public Parser() : this(new RootCommand()) /// Parses a list of arguments. /// /// The string array typically passed to a program's Main method. - /// Holds the value of a complete command line input prior to splitting and tokenization, when provided. This will typically not be available when the parser is called from Program.Main. It is primarily used when calculating completions via the dotnet-suggest tool. + /// The complete command line input prior to splitting and tokenization. This input is not typically available when the parser is called from Program.Main. It is primarily used when calculating completions via the dotnet-suggest tool. /// A providing details about the parse operation. public ParseResult Parse( IReadOnlyList arguments, From 893a11765891318543fc83e5f177787d69c021eb Mon Sep 17 00:00:00 2001 From: Tom Dykstra Date: Tue, 5 Apr 2022 13:21:09 -0700 Subject: [PATCH 2/3] Update src/System.CommandLine/Parsing/Parser.cs Co-authored-by: Genevieve Warren <24882762+gewarren@users.noreply.github.com> --- src/System.CommandLine/Parsing/Parser.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/System.CommandLine/Parsing/Parser.cs b/src/System.CommandLine/Parsing/Parser.cs index b2591fc192..8c1b21827d 100644 --- a/src/System.CommandLine/Parsing/Parser.cs +++ b/src/System.CommandLine/Parsing/Parser.cs @@ -23,7 +23,7 @@ public Parser(Command command) : this(new CommandLineConfiguration(command)) } /// - /// Initializes a new instance of the class using the default . + /// Initializes a new instance of the class using the default . /// public Parser() : this(new RootCommand()) { From f1c90b86ae8f69821ccd44c10b531f75fa34d9ef Mon Sep 17 00:00:00 2001 From: Tom Dykstra Date: Tue, 5 Apr 2022 13:53:53 -0700 Subject: [PATCH 3/3] add builder param --- src/System.CommandLine/Builder/CommandLineBuilderExtensions.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/System.CommandLine/Builder/CommandLineBuilderExtensions.cs b/src/System.CommandLine/Builder/CommandLineBuilderExtensions.cs index 785957c4f5..c9a464a7b5 100644 --- a/src/System.CommandLine/Builder/CommandLineBuilderExtensions.cs +++ b/src/System.CommandLine/Builder/CommandLineBuilderExtensions.cs @@ -115,6 +115,7 @@ public static CommandLineBuilder EnableDirectives( /// /// Determines the behavior when parsing a double dash (--) in a command line. /// + /// A command line builder. /// to place all tokens following -- into the collection. to treat all tokens following -- as command arguments, even if they match an existing option. public static CommandLineBuilder EnableLegacyDoubleDashBehavior( this CommandLineBuilder builder,