-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Upgrade RT libraries * Move Test1Cmd class to separate file * Add a test for subcommands that uses JSON comparison to test the whole result
- Loading branch information
Showing
12 changed files
with
99 additions
and
2,244 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
Submodule RT.Util
updated
22 files
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
using System.Reflection; | ||
using System.Reflection; | ||
using RT.Internal; | ||
using RT.PostBuild; | ||
using RT.Util; | ||
|
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
using RT.Util.Consoles; | ||
|
||
namespace RT.CommandLine.Tests; | ||
|
||
class Test1Cmd : ICommandLineValidatable | ||
{ | ||
[IsPositional, IsMandatory] | ||
public string Base; | ||
|
||
[IsPositional, IsMandatory] | ||
public Test1SubcommandBase Subcommand; | ||
Check warning on line 11 in Tests/Test1.cs GitHub Actions / build
|
||
|
||
public static int ValidateCalled = 0; | ||
|
||
public ConsoleColoredString Validate() | ||
{ | ||
ValidateCalled++; | ||
return null; | ||
} | ||
} | ||
|
||
[CommandGroup] | ||
abstract class Test1SubcommandBase : ICommandLineValidatable | ||
{ | ||
public static int ValidateCalled = 0; | ||
public abstract ConsoleColoredString Validate(); | ||
} | ||
|
||
[CommandName("sub1")] | ||
sealed class Test1Subcommand1 : Test1SubcommandBase | ||
{ | ||
[IsPositional, IsMandatory] | ||
public string ItemName; | ||
|
||
public override ConsoleColoredString Validate() | ||
{ | ||
ValidateCalled++; | ||
return null; | ||
} | ||
} | ||
|
||
[CommandName("sub2")] | ||
sealed class Test1Subcommand2 : Test1SubcommandBase | ||
{ | ||
public override ConsoleColoredString Validate() { return null; } | ||
} |
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,30 @@ | ||
namespace RT.CommandLine.Tests; | ||
|
||
class Test2Cmd | ||
{ | ||
[Option("-b")] | ||
public bool Boolean; | ||
|
||
public Test2Subcommand Subcommand; | ||
Check warning on line 8 in Tests/Test2.cs GitHub Actions / build
|
||
} | ||
|
||
[CommandGroup] | ||
abstract class Test2Subcommand | ||
{ | ||
[Option("-k")] | ||
public string SharedString; | ||
} | ||
|
||
[CommandName("add")] | ||
class Test2SubcommandAdd : Test2Subcommand | ||
{ | ||
[IsPositional, IsMandatory] | ||
public string Name; | ||
} | ||
|
||
[CommandName("del")] | ||
class Test2SubcommandDelete : Test2Subcommand | ||
{ | ||
[IsPositional, IsMandatory] | ||
public string Id; | ||
} |