mirror of
				https://github.com/nsnail/spectre.console.git
				synced 2025-10-31 09:09:25 +08:00 
			
		
		
		
	Updated Commands with with new Execute() method signature
This commit is contained in:
		 Jay Turpin
					Jay Turpin
				
			
				
					committed by
					
						 Patrik Svensson
						Patrik Svensson
					
				
			
			
				
	
			
			
			 Patrik Svensson
						Patrik Svensson
					
				
			
						parent
						
							07db28bb6f
						
					
				
				
					commit
					35568ab823
				
			| @@ -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. | ||||
|   | ||||
		Reference in New Issue
	
	Block a user