Add required modifiers

This commit is contained in:
Oleksii Holub
2022-12-08 03:08:58 +02:00
parent aac9c968eb
commit 15150cb3ed
4 changed files with 8 additions and 8 deletions

View File

@@ -383,7 +383,7 @@ If the user does not provide value for such option through command line argument
public class AuthCommand : ICommand
{
[CommandOption("token", IsRequired = true, EnvironmentVariable = "AUTH_TOKEN")]
public string AuthToken { get; init; }
public required string AuthToken { get; init; }
public ValueTask ExecuteAsync(IConsole console)
{
@@ -500,10 +500,10 @@ This special exception can be used to print an error message to the console, ret
public class DivideCommand : ICommand
{
[CommandOption("dividend", IsRequired = true)]
public double Dividend { get; init; }
public required double Dividend { get; init; }
[CommandOption("divisor", IsRequired = true)]
public double Divisor { get; init; }
public required double Divisor { get; init; }
public ValueTask ExecuteAsync(IConsole console)
{
@@ -727,4 +727,4 @@ var app = new CliApplicationBuilder()
## Etymology
**CliFx** is made out of "Cli" for "Command Line Interface" and "Fx" for "Framework".
It's pronounced as "cliff ex".
It's pronounced as "cliff ex".