Updated Commands with with new Execute() method signature

This commit is contained in:
Jay Turpin 2021-01-13 10:28:33 -07:00 committed by Patrik Svensson
parent 07db28bb6f
commit 35568ab823

View File

@ -58,17 +58,19 @@ in the previous step.
```csharp
public class AddPackageCommand : Command<AddPackageSettings>
{
public override int Execute(AddPackageSettings settings, ILookup<string, string> remaining)
public override int Execute(CommandContext context, AddPackageSettings settings)
{
// Omitted
return 0;
}
}
public class AddReferenceCommand : Command<AddReferenceSettings>
{
public override int Execute(AddReferenceSettings settings, ILookup<string, string> remaining)
public override int Execute(CommandContext context, AddReferenceSettings settings)
{
// 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
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
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.