mirror of
https://github.com/nsnail/spectre.console.git
synced 2025-04-17 01:12:50 +08:00

Also moves tests to `./test` which makes it possible for all test projects to share the same .editorconfig files and similar.
41 lines
1.2 KiB
C#
41 lines
1.2 KiB
C#
using System;
|
|
using System.ComponentModel;
|
|
using Spectre.Console.Cli;
|
|
|
|
namespace Spectre.Console.Tests.Data
|
|
{
|
|
public sealed class OptionalArgumentWithDefaultValueSettings : CommandSettings
|
|
{
|
|
[CommandArgument(0, "[GREETING]")]
|
|
[DefaultValue("Hello World")]
|
|
public string Greeting { get; set; }
|
|
}
|
|
|
|
public sealed class OptionalArgumentWithPropertyInitializerSettings : CommandSettings
|
|
{
|
|
[CommandArgument(0, "[NAMES]")]
|
|
public string[] Names { get; set; } = Array.Empty<string>();
|
|
|
|
[CommandOption("-c")]
|
|
public int Count { get; set; } = 1;
|
|
|
|
[CommandOption("-v")]
|
|
public int Value { get; set; } = 0;
|
|
}
|
|
|
|
public sealed class OptionalArgumentWithDefaultValueAndTypeConverterSettings : CommandSettings
|
|
{
|
|
[CommandArgument(0, "[GREETING]")]
|
|
[DefaultValue("5")]
|
|
[TypeConverter(typeof(StringToIntegerConverter))]
|
|
public int Greeting { get; set; }
|
|
}
|
|
|
|
public sealed class RequiredArgumentWithDefaultValueSettings : CommandSettings
|
|
{
|
|
[CommandArgument(0, "<GREETING>")]
|
|
[DefaultValue("Hello World")]
|
|
public string Greeting { get; set; }
|
|
}
|
|
}
|