Skip to content

Commit 4fd06b8

Browse files
authored
Update Argument.HelpName and SymbolResult.GetResult API docs (#2701)
1 parent c32f786 commit 4fd06b8

File tree

2 files changed

+20
-4
lines changed

2 files changed

+20
-4
lines changed

src/System.CommandLine/Argument.cs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,21 @@ public ArgumentArity Arity
4545
}
4646

4747
/// <summary>
48-
/// The name used in help output to describe the argument.
48+
/// Gets or sets the placeholder name shown in usage help for the argument's value.
49+
/// The value will be wrapped in angle brackets (<c>&lt;</c> and <c>&gt;</c>).
4950
/// </summary>
51+
/// <remarks>
52+
/// If <c>null</c>, the <see cref="Symbol.Name"/> of the argument will be used.
53+
/// </remarks>
54+
/// <example>
55+
/// An argument with <see cref="Symbol.Name"/> of <c>argument</c> and a
56+
/// <see cref="HelpName"/> of <c>Value</c> will be shown in usage help as:
57+
/// <c>&lt;Value&gt;</c>. If <see cref="HelpName"/> is not set,
58+
/// help output will show: <c>&lt;argument&gt;</c>.
59+
/// </example>
60+
/// <value>
61+
/// The name to show as the placeholder for the argument's value.
62+
/// </value>
5063
public string? HelpName { get; set; }
5164

5265
internal TryConvertArgument? ConvertArguments

src/System.CommandLine/Parsing/SymbolResult.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,13 @@ public IEnumerable<ParseError> Errors
9191
public DirectiveResult? GetResult(Directive directive) => SymbolResultTree.GetResult(directive);
9292

9393
/// <summary>
94-
/// Finds a result for a symbol having the specified name anywhere in the parse tree.
94+
/// Finds a result for a <see cref="Symbol" /> having the specified <paramref name="name" /> anywhere in the parse tree.
9595
/// </summary>
96-
/// <param name="name">The name of the symbol for which to find a result.</param>
97-
/// <returns>An argument result if the argument was matched by the parser or has a default value; otherwise, <c>null</c>.</returns>
96+
/// <param name="name">The name of the <see cref="Symbol" /> for which to find a result.</param>
97+
/// <returns>
98+
/// A <see cref="SymbolResult" /> if the <see cref="Symbol" /> was matched by the parser or has a default value;
99+
/// otherwise, <see langword="null" />.
100+
/// </returns>
98101
public SymbolResult? GetResult(string name) =>
99102
SymbolResultTree.GetResult(name);
100103

0 commit comments

Comments
 (0)