mirror of
https://github.com/spectreconsole/spectre.console.git
synced 2026-01-02 01:03:32 +01:00
Remove Spectre.Console.Cli from repository
* Move Spectre.Console.Cli to its own repository * Update build script to use Cake.Sdk and .NET Make * Remove StyleCop (unmaintained) * Add linting using dotnet format * Fix generator which was broken * Update dependencies
This commit is contained in:
committed by
Patrik Svensson
parent
1ec7b8ae8f
commit
45799107a3
@@ -1,9 +1,6 @@
|
||||
Title: CommandApp
|
||||
Order: 2
|
||||
Description: "**CommandApp** is the entry point for a *Spectre.Console.Cli* command line application. It is used to configure the settings and commands used for execution of the application."
|
||||
Reference:
|
||||
- T:Spectre.Console.Cli.CommandApp
|
||||
- T:Spectre.Console.Cli.CommandApp`1
|
||||
---
|
||||
|
||||
`CommandApp` is the entry point for a `Spectre.Console.Cli` command line application. It is used to configure the settings and commands used for execution of the application. Most `Spectre.Console.Cli` applications will need to specify a custom configuration using the `Configure` method.
|
||||
@@ -76,7 +73,7 @@ return app.Run(args);
|
||||
```
|
||||
|
||||
<?# Alert ?>
|
||||
`MyTypeRegistrar` is a custom class that implements [ITypeRegistrar](xref:T:Spectre.Console.Cli.ITypeRegistrar) and must be provided by the user.
|
||||
`MyTypeRegistrar` is a custom class that implements `ITypeRegistrar` and must be provided by the user.
|
||||
<?#/ Alert ?>
|
||||
|
||||
There is a working [example of dependency injection](https://github.com/spectreconsole/examples/tree/main/examples/Cli/Injection) that uses `Microsoft.Extensions.DependencyInjection` as the container. Example implementations of `ITypeRegistrar` and `ITypeResolver` are provided, which you can copy and paste to your application for dependency injection.
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
Title: Creating Commands
|
||||
Order: 6
|
||||
Description: "How to create commands for *Spectre.Console.Cli*"
|
||||
Reference:
|
||||
- T:Spectre.Console.Cli.AsyncCommand`1
|
||||
- T:Spectre.Console.Cli.Command`1
|
||||
---
|
||||
|
||||
Commands in `Spectre.Console.Cli` are defined by creating a class that inherits from either `Command<TSettings>` or `AsyncCommand<TSettings>`. `Command<TSettings>` must implement an `Execute` method that returns an int where as `AsyncCommand<TSettings>` must implement `ExecuteAsync` returning `Task<int>`.
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
Title: Specifying Settings
|
||||
Order: 5
|
||||
Description: "How to define command line argument settings for your *Spectre.Console.Cli* Commands"
|
||||
Reference:
|
||||
- T:Spectre.Console.Cli.CommandSettings
|
||||
- T:Spectre.Console.Cli.CommandArgumentAttribute
|
||||
- T:Spectre.Console.Cli.CommandOptionAttribute
|
||||
---
|
||||
|
||||
Settings for `Spectre.Console.Cli` commands are defined via classes that inherit from `CommandSettings`. Attributes are used to indicate how the parser interprets the command line arguments and create a runtime instance of the settings to be used.
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
Title: Unit Testing
|
||||
Order: 14
|
||||
Description: Instructions for unit testing a Spectre.Console application.
|
||||
Reference:
|
||||
- T:Spectre.Console.Testing.CommandAppTester
|
||||
- T:Spectre.Console.Testing.TestConsole
|
||||
- T:Spectre.Console.Testing.TestConsoleInput
|
||||
---
|
||||
|
||||
`Spectre.Console` has a separate project that contains test harnesses for unit testing your own console applications.
|
||||
|
||||
Reference in New Issue
Block a user