From 974aa1afda8ac14afd27d778faa8990b396928ea Mon Sep 17 00:00:00 2001 From: Andrew Rublyov Date: Mon, 20 Dec 2021 21:06:50 +0200 Subject: [PATCH] Fix inheritance and nullables in settings.md --- docs/input/cli/settings.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/input/cli/settings.md b/docs/input/cli/settings.md index 18c75a4..9583c6c 100644 --- a/docs/input/cli/settings.md +++ b/docs/input/cli/settings.md @@ -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]")]