Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply comments from #7859 #1701

Merged
merged 4 commits into from
Apr 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,9 @@ public static CommandLineBuilder CancelOnProcessTermination(this CommandLineBuil
/// Enables the parser to recognize command line directives.
/// </summary>
/// <param name="builder">A command line builder.</param>
/// <param name="value">If set to <see langword="true"/>, then directives are enabled. Otherwise, they are parsed like any other token.</param>
/// <param name="value"><see langword="true" /> to enable directives. <see langword="false" /> to parse directive-like tokens in the same way as any other token.</param>
/// <returns>The same instance of <see cref="CommandLineBuilder"/>.</returns>
/// <seealso href="/dotnet/standard/commandline/syntax#directives">Command-line directives</seealso>
/// <seealso cref="DirectiveCollection"/>
public static CommandLineBuilder EnableDirectives(
this CommandLineBuilder builder,
Expand All @@ -114,7 +115,8 @@ public static CommandLineBuilder EnableDirectives(
/// <summary>
/// Determines the behavior when parsing a double dash (<c>--</c>) in a command line.
/// </summary>
/// <remarks>When set to <see langword="true"/>, all tokens following <c>--</c> will be placed into the <see cref="ParseResult.UnparsedTokens"/> collection. When set to <see langword="false"/>, all tokens following <c>--</c> will be treated as command arguments, even if they match an existing option.</remarks>
/// <param name="builder">A command line builder.</param>
/// <param name="value"><see langword="true" /> to place all tokens following <c>--</c> into the <see cref="ParseResult.UnparsedTokens"/> collection. <see langword="false" /> to treat all tokens following <c>--</c> as command arguments, even if they match an existing option.</param>
public static CommandLineBuilder EnableLegacyDoubleDashBehavior(
this CommandLineBuilder builder,
bool value = true)
Expand All @@ -127,7 +129,7 @@ public static CommandLineBuilder EnableLegacyDoubleDashBehavior(
/// Enables the parser to recognize and expand POSIX-style bundled options.
/// </summary>
/// <param name="builder">A command line builder.</param>
/// <param name="value">If set to <see langword="true"/>, then POSIX bundles are parsed. ; otherwise, <see langword="false"/>.</param>
/// <param name="value"><see langword="true"/> to parse POSIX bundles; otherwise, <see langword="false"/>.</param>
/// <returns>The same instance of <see cref="CommandLineBuilder"/>.</returns>
/// <remarks>
/// POSIX conventions recommend that single-character options be allowed to be specified together after a single <c>-</c> prefix. When <see cref="EnablePosixBundling"/> is set to <see langword="true"/>, the following command lines are equivalent:
Expand Down
9 changes: 6 additions & 3 deletions src/System.CommandLine/IdentifierSymbol.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,12 @@ public override string Name
}

/// <summary>
/// Adds an alias. Multiple aliases can be added, most often used to provide a shorthand alternative.
/// Adds an <see href="/dotnet/standard/commandline/syntax#aliases">alias</see>.
/// </summary>
/// <param name="alias">The alias to add.</param>
/// <remarks>
/// You can add multiple aliases for a symbol.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought there was some info added about what aliases could be used for. Not serious though.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I replaced that in the summary with a link on "alias" to the aliases section of the syntax article https://docs.microsoft.com/dotnet/standard/commandline/syntax#aliases

/// </remarks>
public void AddAlias(string alias)
{
ThrowIfAliasIsInvalid(alias);
Expand All @@ -73,10 +76,10 @@ public void AddAlias(string alias)
private protected virtual void RemoveAlias(string alias) => _aliases.Remove(alias);

/// <summary>
/// Determines whether the alias has already been defined.
/// Determines whether the specified alias has already been defined.
/// </summary>
/// <param name="alias">The alias to search for.</param>
/// <returns><see langword="true">true</see> if the alias has already been defined; otherwise <see langkeyword="true">false</see>.</returns>
/// <returns><see langword="true" /> if the alias has already been defined; otherwise <see langword="false" />.</returns>
public bool HasAlias(string alias) => _aliases.Contains(alias);

[DebuggerStepThrough]
Expand Down
6 changes: 3 additions & 3 deletions src/System.CommandLine/Parsing/Parser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,22 @@ public Parser(Command command) : this(new CommandLineConfiguration(command))
}

/// <summary>
/// Initializes a new instance of the Parser class with using the default <seealso cref="RootCommand"/>.
/// Initializes a new instance of the <see cref="Parser" /> class using the default <see cref="RootCommand" />.
/// </summary>
public Parser() : this(new RootCommand())
{
}

/// <summary>
/// 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.
/// </summary>
public CommandLineConfiguration Configuration { get; }

/// <summary>
/// Parses a list of arguments.
/// </summary>
/// <param name="arguments">The string array typically passed to a program's <c>Main</c> method.</param>
/// <param name="rawInput">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 <c>Program.Main</c>. It is primarily used when calculating completions via the <c>dotnet-suggest</c> tool.</param>
/// <param name="rawInput">The complete command line input prior to splitting and tokenization. This input is not typically available when the parser is called from <c>Program.Main</c>. It is primarily used when calculating completions via the <c>dotnet-suggest</c> tool.</param>
/// <returns>A <see cref="ParseResult"/> providing details about the parse operation.</returns>
public ParseResult Parse(
IReadOnlyList<string> arguments,
Expand Down