Skip to content

Commit 18a0a54

Browse files
authored
Augment and correct the Option.HelpName API docs (#2687)
1 parent fab13a3 commit 18a0a54

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

src/System.CommandLine/Option.cs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,22 @@ protected Option(string name, string[] aliases) : base(name)
4141
public bool HasDefaultValue => Argument.HasDefaultValue;
4242

4343
/// <summary>
44-
/// Gets or sets the name of the Option when displayed in help.
44+
/// Gets or sets the placeholder name shown in usage help for the option's value.
45+
/// The value will be wrapped in angle brackets (<c>&lt;</c> and <c>&gt;</c>).
4546
/// </summary>
47+
/// <remarks>
48+
/// If <c>null</c>, the <see cref="Symbol.Name"/> of the option will be used,
49+
/// with leading dashes and slashes removed.
50+
/// </remarks>
51+
/// <example>
52+
/// An option with <see cref="Symbol.Name"/> of <c>--option</c> and a
53+
/// <see cref="HelpName"/> of <c>Value</c> will be shown in usage help as:
54+
/// <c>--option &lt;Value&gt;</c>. If <see cref="HelpName"/> is not set,
55+
/// help output will show: <c>--option &lt;option&gt;</c>.
56+
/// </example>
4657
/// <value>
47-
/// The name of the option when displayed in help.
58+
/// The name to show as the placeholder for the option's value.
4859
/// </value>
49-
/// <remarks>Useful for localization, as it's not used for actual parsing.</remarks>
5060
public string? HelpName
5161
{
5262
get => Argument.HelpName;

0 commit comments

Comments
 (0)