Skip to content

Commit d4d31f7

Browse files
authored
Improve help API (#1229)
* WIP * Fixing all tests * Removal of old dead code. * More clean up of help tests * Fix #987 * Fix #984 * Help builder customizations Fixing sizing of grid Cleaning up some of the APIs * Adding HelpItem and allowing for getting the contents of help * Cleaning up the customization * Fixing max width to be a help builder parameter * HelpBuilder cleanup * Adding CommandLineBuilder extensions for configuring help * Remove unused fields * Moving [options] before arguments * Cleaning up naming of descriptor.
1 parent 72e86ec commit d4d31f7

30 files changed

+1684
-1049
lines changed

src/System.CommandLine.DragonFruit.Tests/CommandLineTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public async Task It_shows_help_text_based_on_XML_documentation_comments()
6060
var stdOut = _terminal.Out.ToString();
6161

6262
stdOut.Should()
63-
.Contain("<args> These are arguments")
63+
.Contain("<args> These are arguments")
6464
.And.Contain("Arguments:");
6565
stdOut.Should()
6666
.ContainAll("--name <name>", "Specifies the name option")
@@ -84,7 +84,7 @@ public void It_synchronously_shows_help_text_based_on_XML_documentation_comments
8484
var stdOut = _terminal.Out.ToString();
8585

8686
stdOut.Should()
87-
.Contain("<args> These are arguments")
87+
.Contain("<args> These are arguments")
8888
.And.Contain("Arguments:");
8989
stdOut.Should()
9090
.ContainAll("--name <name>","Specifies the name option")

src/System.CommandLine.Rendering/ConsoleRenderer.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,14 @@ private void Render(TextSpan span, Region region = null)
7676
BackgroundColorSpan.Reset());
7777
}
7878

79-
TextSpanVisitor visitor = null;
80-
8179
if (_mode == OutputMode.Auto)
8280
{
8381
_mode = _terminal?.DetectOutputMode() ??
8482
OutputMode.PlainText;
8583
}
8684

85+
86+
TextSpanVisitor visitor;
8787
switch (_mode)
8888
{
8989
case OutputMode.NonAnsi:
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
1-
the-root-command:
1+
the-root-command
22
Test description
33

44
Usage:
55
the-root-command [options] <the-root-arg-no-description-no-default> [<the-root-arg-no-description-default> <the-root-arg-no-default> [<the-root-arg> [<the-root-arg-enum-default>]]]
66

77
Arguments:
88
<the-root-arg-no-description-no-default>
9-
<the-root-arg-no-description-default> [default: the-root-arg-no-description-default-value]
10-
<the-root-arg-no-default> the-root-arg-no-default-description
11-
<the-root-arg> the-root-arg-description [default: the-root-arg-one-value]
12-
<Read|ReadWrite|Write> the-root-arg-enum-default-description [default: Read]
9+
<the-root-arg-no-description-default> [default: the-root-arg-no-description-default-value]
10+
<the-root-arg-no-default> the-root-arg-no-default-description
11+
<the-root-arg> the-root-arg-description [default: the-root-arg-one-value]
12+
<Read|ReadWrite|Write> the-root-arg-enum-default-description [default: Read]
1313

1414
Options:
15-
-trna, --the-root-option-no-arg (REQUIRED) the-root-option-no-arg-description
16-
-trondda, --the-root-option-no-description-default-arg <the-root-option-no-description-default-arg> [default: the-root-option--no-description-default-arg-value]
17-
-tronda, --the-root-option-no-default-arg <the-root-option-arg-no-default-arg> (REQUIRED) the-root-option-no-default-description
18-
-troda, --the-root-option-default-arg <the-root-option-arg> the-root-option-default-arg-description [default: the-root-option-arg-value]
19-
-troea, --the-root-option-enum-arg <Read|ReadWrite|Write> the-root-option-description [default: Read]
20-
-trorea, --the-root-option-required-enum-arg <Read|ReadWrite|Write> (REQUIRED) the-root-option-description [default: Read]
21-
-tromld, --the-root-option-multi-line-description the-root-option
22-
multi-line
23-
description
15+
-trna, --the-root-option-no-arg (REQUIRED) the-root-option-no-arg-description
16+
-trondda, --the-root-option-no-description-default-arg <the-root-option-no-description-default-arg> [default: the-root-option--no-description-default-arg-value]
17+
-tronda, --the-root-option-no-default-arg <the-root-option-arg-no-default-arg> (REQUIRED) the-root-option-no-default-description
18+
-troda, --the-root-option-default-arg <the-root-option-arg> the-root-option-default-arg-description [default: the-root-option-arg-value]
19+
-troea, --the-root-option-enum-arg <Read|ReadWrite|Write> the-root-option-description [default: Read]
20+
-trorea, --the-root-option-required-enum-arg <Read|ReadWrite|Write> (REQUIRED) the-root-option-description [default: Read]
21+
-tromld, --the-root-option-multi-line-description the-root-option
22+
multi-line
23+
description
2424

0 commit comments

Comments
 (0)