-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
30 changed files
with
170 additions
and
175 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
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 |
---|---|---|
|
@@ -348,3 +348,6 @@ MigrationBackup/ | |
|
||
# Ionide (cross platform F# VS Code tools) working folder | ||
.ionide/ | ||
|
||
# Jetbrains | ||
.idea/* |
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
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,29 +1,28 @@ | ||
using Spectre.Console.Cli; | ||
|
||
namespace BasicWay.Common.Spectre | ||
namespace BasicWay.Common.Spectre; | ||
|
||
public sealed class SpectreCommandApp : ICommandApp | ||
{ | ||
public class SpectreCommandApp : ICommandApp | ||
{ | ||
private readonly ICommandApp _commandApp; | ||
private readonly ICommandApp _commandApp; | ||
|
||
public SpectreCommandApp(ITypeRegistrar registrar) | ||
{ | ||
_commandApp = new CommandApp(registrar); | ||
} | ||
public SpectreCommandApp(ITypeRegistrar registrar) | ||
{ | ||
_commandApp = new CommandApp(registrar); | ||
} | ||
|
||
public void Configure(Action<IConfigurator> configuration) | ||
{ | ||
_commandApp.Configure(configuration); | ||
} | ||
public void Configure(Action<IConfigurator> configuration) | ||
{ | ||
_commandApp.Configure(configuration); | ||
} | ||
|
||
public int Run(IEnumerable<string> args) | ||
{ | ||
return _commandApp.Run(args); | ||
} | ||
public int Run(IEnumerable<string> args) | ||
{ | ||
return _commandApp.Run(args); | ||
} | ||
|
||
public Task<int> RunAsync(IEnumerable<string> args) | ||
{ | ||
return _commandApp.RunAsync(args); | ||
} | ||
public Task<int> RunAsync(IEnumerable<string> args) | ||
{ | ||
return _commandApp.RunAsync(args); | ||
} | ||
} | ||
} |
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,18 +1,17 @@ | ||
using Spectre.Console; | ||
|
||
namespace BasicWay.Common.Spectre | ||
namespace BasicWay.Common.Spectre; | ||
|
||
public static class SpectreExtensions | ||
{ | ||
public static class SpectreExtensions | ||
public static void RenderException<T>(this T exception) where T : Exception | ||
{ | ||
public static void RenderException<T>(this T exception) where T : Exception | ||
{ | ||
const ExceptionFormats formats = ExceptionFormats.ShortenTypes | ||
| ExceptionFormats.ShortenPaths | ||
| ExceptionFormats.ShortenMethods; | ||
const ExceptionFormats formats = ExceptionFormats.ShortenTypes | ||
| ExceptionFormats.ShortenPaths | ||
| ExceptionFormats.ShortenMethods; | ||
|
||
AnsiConsole.WriteLine(); | ||
AnsiConsole.WriteException(exception, formats); | ||
AnsiConsole.WriteLine(); | ||
} | ||
AnsiConsole.WriteLine(); | ||
AnsiConsole.WriteException(exception, formats); | ||
AnsiConsole.WriteLine(); | ||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,27 @@ | ||
using CustomWay.Common.Spectre; | ||
using Spectre.Console.Cli; | ||
|
||
namespace CustomWay.Commands.Math | ||
namespace CustomWay.Commands.Math; | ||
|
||
public sealed class MathConfigurator : ISpectreConfigurator | ||
{ | ||
public class MathConfigurator : ISpectreConfigurator | ||
{ | ||
public int Rank => 1; | ||
public int Rank => 1; | ||
|
||
public void Configure(IConfigurator config) | ||
public void Configure(IConfigurator config) | ||
{ | ||
config.AddBranch("math", math => | ||
{ | ||
config.AddBranch("math", math => | ||
{ | ||
math | ||
.AddCommand<AddCommand>("add") | ||
.WithAlias("addition") | ||
.WithDescription("Addition of two numbers") | ||
.WithExample(new[] { "math", "add", "8", "5" }); | ||
math | ||
.AddCommand<AddCommand>("add") | ||
.WithAlias("addition") | ||
.WithDescription("Addition of two numbers") | ||
.WithExample("math", "add", "8", "5"); | ||
math | ||
.AddCommand<SubCommand>("sub") | ||
.WithAlias("subtraction") | ||
.WithDescription("Subtraction of two numbers") | ||
.WithExample(new[] { "math", "sub", "6", "2" }); | ||
}); | ||
} | ||
math | ||
.AddCommand<SubCommand>("sub") | ||
.WithAlias("subtraction") | ||
.WithDescription("Subtraction of two numbers") | ||
.WithExample("math", "sub", "6", "2"); | ||
}); | ||
} | ||
} | ||
} |
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
Oops, something went wrong.