mirror of
https://github.com/nsnail/spectre.console.git
synced 2025-04-16 08:52:50 +08:00
Updated Commands with with new Execute() method signature
This commit is contained in:
parent
07db28bb6f
commit
35568ab823
@ -58,17 +58,19 @@ in the previous step.
|
|||||||
```csharp
|
```csharp
|
||||||
public class AddPackageCommand : Command<AddPackageSettings>
|
public class AddPackageCommand : Command<AddPackageSettings>
|
||||||
{
|
{
|
||||||
public override int Execute(AddPackageSettings settings, ILookup<string, string> remaining)
|
public override int Execute(CommandContext context, AddPackageSettings settings)
|
||||||
{
|
{
|
||||||
// Omitted
|
// Omitted
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class AddReferenceCommand : Command<AddReferenceSettings>
|
public class AddReferenceCommand : Command<AddReferenceSettings>
|
||||||
{
|
{
|
||||||
public override int Execute(AddReferenceSettings settings, ILookup<string, string> remaining)
|
public override int Execute(CommandContext context, AddReferenceSettings settings)
|
||||||
{
|
{
|
||||||
// Omitted
|
// Omitted
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
@ -114,4 +116,4 @@ This make the resulting code very clean and easy to navigate, not to mention to
|
|||||||
And most importantly at all, the type system guides me to do the right thing. I can't configure
|
And most importantly at all, the type system guides me to do the right thing. I can't configure
|
||||||
commands in non-compatible ways, and if I want to add a new top-level `add-package` command
|
commands in non-compatible ways, and if I want to add a new top-level `add-package` command
|
||||||
(or move the command completely), it's just a single line to change. This makes it easy to
|
(or move the command completely), it's just a single line to change. This makes it easy to
|
||||||
experiment and makes the CLI experience a first class citizen of your application.
|
experiment and makes the CLI experience a first class citizen of your application.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user