Default values

C# supports default values for parameters and so does this library.

Let's make some changes to Calculator to add a new Command - Divide. And let's default value2 to 1 when user doesn't provide a value. This will prevent the calculator from crashing because of DivideByZeroException

public void Divide(int value1, int value2 = 1)
    Console.WriteLine($"Answer: {value1 / value2}");

Here's how help looks like:


dotnet example.dll Divide --help 


Usage: dotnet example.dll Divide [arguments] [options]

  value1  Int32
  value2  Int32 | Default value: 1

  -h | -? | --help  Show help information