mirror of
				https://github.com/nsnail/spectre.console.git
				synced 2025-10-31 09:09:25 +08:00 
			
		
		
		
	Fix inheritance and nullables in settings.md
This commit is contained in:
		 Andrew Rublyov
					Andrew Rublyov
				
			
				
					committed by
					
						 Phil Scott
						Phil Scott
					
				
			
			
				
	
			
			
			 Phil Scott
						Phil Scott
					
				
			
						parent
						
							66fc949e2a
						
					
				
				
					commit
					974aa1afda
				
			| @@ -15,7 +15,7 @@ Example: | ||||
| public sealed class MyCommandSettings : CommandSettings | ||||
| { | ||||
|     [CommandArgument(0, "[name]")] | ||||
|     public string Name { get; set; } | ||||
|     public string? Name { get; set; } | ||||
|  | ||||
|     [CommandOption("-c|--count")] | ||||
|     public int Count { get; set; } | ||||
| @@ -37,7 +37,7 @@ For example, we could split the above name argument into two values with an opti | ||||
| public string FirstName { get; set; } | ||||
|  | ||||
| [CommandArgument(1, "[lastName]")] | ||||
| public string LastName { get; set; } | ||||
| public string? LastName { get; set; } | ||||
| ``` | ||||
|  | ||||
| ## CommandOption | ||||
| @@ -100,7 +100,7 @@ Would allow the user to run `app.exe Dwayne Elizondo "Mountain Dew" Herbert Cama | ||||
| `Spectre.Console.Cli` supports constructor initialization and init only initialization. For constructor initialization, the parameter name of the constructor must match the name of the property name of the settings class. Order does not matter. | ||||
|  | ||||
| ```csharp | ||||
| public class Settings | ||||
| public class Settings : CommandSettings | ||||
| { | ||||
|     public Settings(string[] name) | ||||
|     { | ||||
| @@ -116,7 +116,7 @@ public class Settings | ||||
| Also supported are init only properties. | ||||
|  | ||||
| ```csharp | ||||
| public class Settings | ||||
| public class Settings : CommandSettings | ||||
| { | ||||
|     [Description("The name to display")] | ||||
|     [CommandArgument(0, "[Name]")] | ||||
| @@ -129,7 +129,7 @@ public class Settings | ||||
| Simple type validation is performed automatically, but for scenarios where more complex validation is required, overriding the `Validate` method is supported. This method must return either `ValidationResult.Error` or `ValidationResult.Success`. | ||||
|  | ||||
| ```csharp | ||||
| public class Settings | ||||
| public class Settings : CommandSettings | ||||
| { | ||||
|     [Description("The name to display")] | ||||
|     [CommandArgument(0, "[Name]")] | ||||
|   | ||||
		Reference in New Issue
	
	Block a user