-
-
Notifications
You must be signed in to change notification settings - Fork 532
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add to cli xmldoc hidden command defaultvalue for options
- Loading branch information
1 parent
5c87d7f
commit 9f2226a
Showing
12 changed files
with
127 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
test/Spectre.Console.Cli.Tests/Expectations/Cli/Root.DefaultValue.verified.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Model> | ||
<!--CAT--> | ||
<Command Name="cat" IsBranch="false" ClrType="Spectre.Console.Tests.Data.CatCommand" Settings="Spectre.Console.Tests.Data.CatSettings"> | ||
<Parameters> | ||
<Argument Name="LEGS" Position="0" Required="false" Kind="scalar" ClrType="System.Int32"> | ||
<Description>The number of legs.</Description> | ||
<Validators> | ||
<Validator ClrType="Spectre.Console.Tests.Data.EvenNumberValidatorAttribute" Message="Animals must have an even number of legs." /> | ||
<Validator ClrType="Spectre.Console.Tests.Data.PositiveNumberValidatorAttribute" Message="Number of legs must be greater than 0." /> | ||
</Validators> | ||
</Argument> | ||
<Option Short="" Long="agility" Value="VALUE" Required="false" Kind="scalar" ClrType="System.Int32"> | ||
<Description>The agility between 0 and 100.</Description> | ||
<DefaultValue>10</DefaultValue> | ||
</Option> | ||
<Option Short="a" Long="alive,not-dead" Value="NULL" Required="false" Kind="flag" ClrType="System.Boolean"> | ||
<Description>Indicates whether or not the animal is alive.</Description> | ||
<DefaultValue>False</DefaultValue> | ||
</Option> | ||
<Option Short="n,p" Long="name,pet-name" Value="VALUE" Required="false" Kind="scalar" ClrType="System.String" /> | ||
</Parameters> | ||
</Command> | ||
</Model> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
test/Spectre.Console.Cli.Tests/Unit/CommandAppTests.Cli.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
namespace Spectre.Console.Tests.Unit.Cli; | ||
|
||
public sealed partial class CommandAppTests | ||
{ | ||
[ExpectationPath("Cli")] | ||
public class Cli | ||
{ | ||
[Fact] | ||
[Expectation("Root", "DefaultValue")] | ||
public Task Should_Print_DefaultValue() | ||
{ | ||
// Given | ||
var app = new CommandAppTester(); | ||
app.Configure(config => | ||
{ | ||
config.PropagateExceptions(); | ||
config.AddCommand<CatCommand>("cat"); | ||
}); | ||
|
||
// When | ||
var result = app.Run(new[] | ||
{ | ||
"cli", "xmldoc", | ||
}); | ||
|
||
// Then | ||
result.ExitCode.ShouldBe(0); | ||
return Verifier.Verify(result.Output); | ||
} | ||
} | ||
} |